Submission #670718

#TimeUsernameProblemLanguageResultExecution timeMemory
670718sofija6Cave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #include "cave.h" using namespace std; void exploreCave(int N) { ll a[N],S[N],D[N]; bool f[N]; for (ll i=0;i<N;i++) { a[i]=1; f[i]=false; } for (ll i=0;i<N;i++) { if (tryCombination(a)!=i) { for (ll j=0;j<N;j++) { if (!f[j]) a[j]=1-a[j]; } } ll l=0,r=N-i,mid,cnt,ans,last; while (l<=r) { mid=(l+r)/2; cnt=mid; for (ll j=0;j<N;j++) { if (!cnt) break; if (!f[j]) { a[j]=1-a[j]; cnt--; last=j; } } if (tryCombination(a)==i) l=mid+1; else { r=mid-1; ans=last; } cnt=mid; for (ll j=0;j<N;j++) { if (!cnt) break; if (!f[j]) { a[j]=1-a[j]; cnt--; } } } S[ans]=1-a[ans]; a[ans]=1-a[ans]; f[ans]=true; D[i]=ans; } answer(S,D); } int main() { ll N; cin >> N; exploreCave(N); return 0; }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:16:28: error: cannot convert 'long long int*' to 'int*'
   16 |         if (tryCombination(a)!=i)
      |                            ^
      |                            |
      |                            long long int*
In file included from cave.cpp:3:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:40:32: error: cannot convert 'long long int*' to 'int*'
   40 |             if (tryCombination(a)==i)
      |                                ^
      |                                |
      |                                long long int*
In file included from cave.cpp:3:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:64:12: error: cannot convert 'long long int*' to 'int*'
   64 |     answer(S,D);
      |            ^
      |            |
      |            long long int*
In file included from cave.cpp:3:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~