Submission #974661

#TimeUsernameProblemLanguageResultExecution timeMemory
974661ivazivaCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "cave.h" using namespace std; #define MAXN 5010 long long pozicija[MAXN]; long long vrata[MAXN]; bool pronadjeno[MAXN] set<long long> nepronadjeni; void exploreCave(int N) { for (long long i=0;i<N;i++) pozicija[i]=0; for (long long i=0;i<N;i++) pronadjeno[i]=false; for (long long i=0;i<N;i++) vrata[i]=-1; for (long long i=0;i<N;i++) nepronadjeni.insert(i); for (long long i=0;i<N;i++) { long long ans0=tryCombination(pozicija); if (ans0>i or ans0==-1) { long long l=0,r=nepronadjeni.size()-1; long long rez=-1; while (l<=r) { long long mid=(l+r)/2; long long brojac=0; for (long long p:nepronadjeni) { if (brojac>mid) break; pozicija[p]=1-pozicija[p];brojac++; } long long ans=tryComination(pozicija); if (ans>i or ans==-1) {rez=mid;r=mid-1;} else l=mid+1; brojac=0; for (long long p:nepronadjeni) { if (brojac>mid) break; pozicija[p]=1-pozicija[p];brojac++; } } long long brojac=0; long long val=-1; for (long long p:nepronadjeni) { if (brojac==rez) {val=p;break;} else brojac++; } pozicija[val]=1;vrata[val]=i; pronadjeno[val]=true; } else { long long l=0,r=nepronadjeni.size()-1; long long rez=-1; while (l<=r) { long long mid=(l+r)/2; long long brojac=0; for (long long p:nepronadjeni) { if (brojac>mid) break; pozicija[p]=1-pozicija[p];brojac++; } long long ans=tryComination(pozicija); if (ans==i) {rez=mid;r=mid-1;} else l=mid+1; brojac=0; for (long long p:nepronadjeni) { if (brojac>mid) break; pozicija[p]=1-pozicija[p];brojac++; } } long long brojac=0; long long val=-1; for (long long p:nepronadjeni) { if (brojac==rez) {val=p;break;} else brojac++; } vrata[val]=i; pronadjeno[val]=true; } } answer(pozicija,vrata); }

Compilation message (stderr)

cave.cpp:11:1: error: expected initializer before 'set'
   11 | set<long long> nepronadjeni;
      | ^~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:16:33: error: 'pronadjeno' was not declared in this scope
   16 |     for (long long i=0;i<N;i++) pronadjeno[i]=false;
      |                                 ^~~~~~~~~~
cave.cpp:18:33: error: 'nepronadjeni' was not declared in this scope
   18 |     for (long long i=0;i<N;i++) nepronadjeni.insert(i);
      |                                 ^~~~~~~~~~~~
cave.cpp:21:24: error: 'tryCombination' was not declared in this scope
   21 |         long long ans0=tryCombination(pozicija);
      |                        ^~~~~~~~~~~~~~
cave.cpp:24:29: error: 'nepronadjeni' was not declared in this scope
   24 |             long long l=0,r=nepronadjeni.size()-1;
      |                             ^~~~~~~~~~~~
cave.cpp:35:31: error: 'tryComination' was not declared in this scope
   35 |                 long long ans=tryComination(pozicija);
      |                               ^~~~~~~~~~~~~
cave.cpp:53:13: error: 'pronadjeno' was not declared in this scope
   53 |             pronadjeno[val]=true;
      |             ^~~~~~~~~~
cave.cpp:57:29: error: 'nepronadjeni' was not declared in this scope
   57 |             long long l=0,r=nepronadjeni.size()-1;
      |                             ^~~~~~~~~~~~
cave.cpp:68:31: error: 'tryComination' was not declared in this scope
   68 |                 long long ans=tryComination(pozicija);
      |                               ^~~~~~~~~~~~~
cave.cpp:86:13: error: 'pronadjeno' was not declared in this scope
   86 |             pronadjeno[val]=true;
      |             ^~~~~~~~~~
cave.cpp:89:5: error: 'answer' was not declared in this scope
   89 |     answer(pozicija,vrata);
      |     ^~~~~~