Submission #1020928

# Submission time Handle Problem Language Result Execution time Memory
1020928 2024-07-12T11:37:38 Z MrAndria DEL13 (info1cup18_del13) C++14
0 / 100
9 ms 1116 KB
#include <bits/stdc++.h>
using namespace std;
#define ff first;
#define ss second
#define pb push_back
//#define int long long
int t,n,q,b1,l;
int a[200005];
vector <int> v;
int main(){
    cin>>t;
    while(t--){
        cin>>n>>q;
        for(int i=1;i<=q;i++){
            cin>>a[i];
        }
        v.clear();
        a[q+1]=n+1;
        for(int i=1;i<=q+1;i++){
            if(a[i]-a[i-1]-1==0){
                v.pb(0);
            }else{
                if((a[i]-a[i-1]-1)%2==0){
                    v.pb(2);
                }else{
                    v.pb(1);
                }
            }
        }
        for(int i=1;i<v.size();i++){
            v[i]-=v[i-1];

        }
        if(v.back()==0){
            cout<<0<<endl;
        }else{
            cout<<-1<<endl;
        }
        // b1=0;
        // v.clear();
        // l=1;
        // for(int i=1;i<=q;i++){
        //     for(int j=1;j<=a[i]-l;j++){
        //         v.pb(a[i]);
        //     }
        //     l=2*a[i]-l+1;
        //     if(i!=q){
        //         if(a[i+1]<l){
        //             b1=1;
        //             break;
        //         }
        //     }else{
        //         if(l!=n+1){
        //             b1=1;
        //             break;
        //         }
        //     }
        // }
        // if(b1){
        //     cout<<-1<<endl;
        // }else{
        //     cout<<v.size()<<endl;
        //     for(int i=0;i<v.size();i++){
        //         cout<<v[i]<<" ";
        //     }
        //     cout<<endl;
        // }
    }
}

Compilation message

del13.cpp: In function 'int main()':
del13.cpp:30:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         for(int i=1;i<v.size();i++){
      |                     ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Incorrect 2 ms 348 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Incorrect 6 ms 348 KB Output isn't correct
4 Incorrect 6 ms 520 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 344 KB Output isn't correct
2 Incorrect 2 ms 348 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Incorrect 6 ms 348 KB Output isn't correct
4 Incorrect 6 ms 520 KB Output isn't correct
5 Incorrect 2 ms 344 KB Output isn't correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Incorrect 1 ms 348 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Incorrect 6 ms 348 KB Output isn't correct
4 Incorrect 6 ms 520 KB Output isn't correct
5 Incorrect 2 ms 344 KB Output isn't correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Incorrect 1 ms 348 KB Output isn't correct
8 Incorrect 8 ms 604 KB Output isn't correct
9 Incorrect 9 ms 860 KB Output isn't correct
10 Incorrect 9 ms 860 KB Output isn't correct
11 Incorrect 8 ms 1116 KB Output isn't correct