19992022-12-13 07:56:20gkataÁruszállítás üres szakaszaicpp17Wrong answer 2/50365ms11956 KiB
#include <iostream>
//#include <fstream>
#include <vector>

using namespace std;

//ifstream cin("aru.in");
//ofstream cout("aru.out");

vector <int> x;

int n,m,a,b,i,db,rdb;

int main()
{
    cin>>n>>m;
    x.resize(n+1);
    while(cin>>a>>b)
    {
        for(i=a;i<=b;++i)
            x[i]=i;
    }

    for(i=1;i<=n;++i)
    {
        if(x[i]==0 && i<n)
            ++db;
        else if(x[i]==0)
            {
                ++db;
                ++rdb;
            }

        else if(x[i]!=0 && db>0)
            ++rdb;
    }
    //for(auto &e:x) cout<<e<<" ";
    cout<<rdb;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Wrong answer0/03ms1880 KiB
2Wrong answer0/082ms9832 KiB
3Wrong answer0/22ms2316 KiB
4Accepted2/22ms2568 KiB
5Wrong answer0/22ms2808 KiB
6Wrong answer0/22ms3020 KiB
7Wrong answer0/22ms3136 KiB
8Wrong answer0/22ms3620 KiB
9Wrong answer0/22ms3552 KiB
10Wrong answer0/22ms3436 KiB
11Wrong answer0/22ms3992 KiB
12Wrong answer0/23ms4512 KiB
13Wrong answer0/36ms4464 KiB
14Wrong answer0/38ms5112 KiB
15Wrong answer0/36ms5060 KiB
16Time limit exceeded0/3358ms6828 KiB
17Time limit exceeded0/3365ms6928 KiB
18Time limit exceeded0/3354ms6964 KiB
19Wrong answer0/39ms6820 KiB
20Wrong answer0/310ms7984 KiB
21Wrong answer0/375ms11956 KiB
22Wrong answer0/379ms11904 KiB