제출 #974662

#제출 시각아이디문제언어결과실행 시간메모리
974662ivaziva동굴 (IOI13_cave)C++14
컴파일 에러
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); }

컴파일 시 표준 에러 (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:39: error: cannot convert 'long long int*' to 'int*'
   21 |         long long ans0=tryCombination(pozicija);
      |                                       ^~~~~~~~
      |                                       |
      |                                       long long int*
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
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; did you mean 'tryCombination'?
   35 |                 long long ans=tryComination(pozicija);
      |                               ^~~~~~~~~~~~~
      |                               tryCombination
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; did you mean 'tryCombination'?
   68 |                 long long ans=tryComination(pozicija);
      |                               ^~~~~~~~~~~~~
      |                               tryCombination
cave.cpp:86:13: error: 'pronadjeno' was not declared in this scope
   86 |             pronadjeno[val]=true;
      |             ^~~~~~~~~~
cave.cpp:89:12: error: cannot convert 'long long int*' to 'int*'
   89 |     answer(pozicija,vrata);
      |            ^~~~~~~~
      |            |
      |            long long int*
In file included from cave.cpp:2:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~