Submission #560997

# Submission time Handle Problem Language Result Execution time Memory
560997 2022-05-12T07:24:46 Z AGE Kocka (COCI18_kocka) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define int long long
using namespace std;
const int N=1e5+5,M=2e3+10,mod=100000000000031;
vector<int>v;

long long  summ(long long  x,long long  y){
    return ((x%mod)+(y%mod))%mod;
}

long long  mult(long long  x,long long  y){
    return ((x%mod)*(y%mod))%mod;
}

int ans[4][M],st[M];
main()
{
    int n;
    cin>>n;
    int ok=0;

    for(int i=1;i<=n;i++){

        int x;
        cin>>x;

        if(x==-1)
            x=n;

        ans[0][i]=x+1;
        st[x+1].insert(i);

    }

    for(int i=1;i<=n;i++){

        int x;
        cin>>x;

        if(x==-1)
            x=n+1;

        if(n-x!=-1&&n-x<ans[0][i])
            ok=1;
        
        ans[1][i]=n-x;
        if(n-x==-1)
            continue;
        
        st[n-x].insert(i);

    }

    for(int i=1;i<=n;i++){

        int x;
        cin>>x;

        if(x==-1)
            x=n+1;
        
        if(st[i].find(x)==1)
            ok=1;

        ans[2][i]=x;

    }

    for(int i=1;i<=n;i++){

        int x;
        cin>>x;

        if(x==-1)
            x=n+1;
        
        if(st[i].find(x)==1)
            ok=1;
    }

    if(ok==1)
        cout<<"NE"<<endl;

    else cout<<"DA"<<endl;

    return 0;
}

/*

3
-1 0 1
-1 2 1
-1 2 -1
1 0 -1


*/

Compilation message

kocka.cpp:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main()
      | ^~~~
kocka.cpp: In function 'int main()':
kocka.cpp:34:17: error: request for member 'insert' in 'st[(x + 1)]', which is of non-class type 'long long int'
   34 |         st[x+1].insert(i);
      |                 ^~~~~~
kocka.cpp:53:17: error: request for member 'insert' in 'st[(n - x)]', which is of non-class type 'long long int'
   53 |         st[n-x].insert(i);
      |                 ^~~~~~
kocka.cpp:65:18: error: request for member 'find' in 'st[i]', which is of non-class type 'long long int'
   65 |         if(st[i].find(x)==1)
      |                  ^~~~
kocka.cpp:80:18: error: request for member 'find' in 'st[i]', which is of non-class type 'long long int'
   80 |         if(st[i].find(x)==1)
      |                  ^~~~