Submission #555345

# Submission time Handle Problem Language Result Execution time Memory
555345 2022-04-30T14:29:18 Z urosk Cave (IOI13_cave) C++14
Compilation error
0 ms 0 KB
#define maxn 5005
ll n;
ll a[maxn];
ll b[maxn];
ll c[maxn];
bool vis[maxn];
void exploreCave(int N) {
    n = N;
    for(ll i = 0;i<n;i++) b[i] = -1;
    for(ll i = 0;i<n;i++) c[i] = 0;
    ll e = tryCombination(c);
    if(e==-1){
        for(ll i = 0;i<n;i++){
            c[i] = 1;
            int e = tryCombination(c);
            b[i] = e;
            c[i] = 0;
        }
        answer(c,b);
    }
    if(n<=2000){
        while(e!=n){
            for(ll j = 0;j<n;j++){
                if(vis[j]) continue;
                c[j]^=1;
                ll f = tryCombination(c);
                if(f==-1) f = n;
                if(f>e){
                    e = f;
                    vis[j] = 1;
                    break;
                }else if(f<e){
                    vis[j] = 1;
                }
                c[j]^=1;
            }
        }
        for(ll i = 0;i<n;i++){
            c[i]^=1;
            int e = tryCombination(c);
            b[i] = e;
            c[i]^=1;
        }
        answer(c,b);
    }
    iota(a,a+n,0);
    for(ll i = 0;i<n;i++){
        c[i] = 1;
        ll e = tryCombination(c);
        if(e==-1) e = n;
        if(e>i) c[i] = 1;
        else c[i] = 0;
    }
    answer(c,a);
}

Compilation message

cave.cpp:2:1: error: 'll' does not name a type
    2 | ll n;
      | ^~
cave.cpp:3:1: error: 'll' does not name a type
    3 | ll a[maxn];
      | ^~
cave.cpp:4:1: error: 'll' does not name a type
    4 | ll b[maxn];
      | ^~
cave.cpp:5:1: error: 'll' does not name a type
    5 | ll c[maxn];
      | ^~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:8:5: error: 'n' was not declared in this scope
    8 |     n = N;
      |     ^
cave.cpp:9:9: error: 'll' was not declared in this scope
    9 |     for(ll i = 0;i<n;i++) b[i] = -1;
      |         ^~
cave.cpp:9:18: error: 'i' was not declared in this scope
    9 |     for(ll i = 0;i<n;i++) b[i] = -1;
      |                  ^
cave.cpp:9:27: error: 'b' was not declared in this scope
    9 |     for(ll i = 0;i<n;i++) b[i] = -1;
      |                           ^
cave.cpp:10:9: error: 'll' was not declared in this scope
   10 |     for(ll i = 0;i<n;i++) c[i] = 0;
      |         ^~
cave.cpp:10:18: error: 'i' was not declared in this scope
   10 |     for(ll i = 0;i<n;i++) c[i] = 0;
      |                  ^
cave.cpp:10:27: error: 'c' was not declared in this scope
   10 |     for(ll i = 0;i<n;i++) c[i] = 0;
      |                           ^
cave.cpp:11:5: error: 'll' was not declared in this scope
   11 |     ll e = tryCombination(c);
      |     ^~
cave.cpp:12:8: error: 'e' was not declared in this scope
   12 |     if(e==-1){
      |        ^
cave.cpp:13:15: error: expected ';' before 'i'
   13 |         for(ll i = 0;i<n;i++){
      |               ^~
      |               ;
cave.cpp:13:22: error: 'i' was not declared in this scope
   13 |         for(ll i = 0;i<n;i++){
      |                      ^
cave.cpp:14:13: error: 'c' was not declared in this scope
   14 |             c[i] = 1;
      |             ^
cave.cpp:15:21: error: 'tryCombination' was not declared in this scope
   15 |             int e = tryCombination(c);
      |                     ^~~~~~~~~~~~~~
cave.cpp:16:13: error: 'b' was not declared in this scope
   16 |             b[i] = e;
      |             ^
cave.cpp:19:16: error: 'c' was not declared in this scope
   19 |         answer(c,b);
      |                ^
cave.cpp:19:18: error: 'b' was not declared in this scope
   19 |         answer(c,b);
      |                  ^
cave.cpp:19:9: error: 'answer' was not declared in this scope
   19 |         answer(c,b);
      |         ^~~~~~
cave.cpp:22:15: error: 'e' was not declared in this scope
   22 |         while(e!=n){
      |               ^
cave.cpp:23:19: error: expected ';' before 'j'
   23 |             for(ll j = 0;j<n;j++){
      |                   ^~
      |                   ;
cave.cpp:23:26: error: 'j' was not declared in this scope
   23 |             for(ll j = 0;j<n;j++){
      |                          ^
cave.cpp:25:17: error: 'c' was not declared in this scope
   25 |                 c[j]^=1;
      |                 ^
cave.cpp:26:19: error: expected ';' before 'f'
   26 |                 ll f = tryCombination(c);
      |                   ^~
      |                   ;
cave.cpp:27:20: error: 'f' was not declared in this scope
   27 |                 if(f==-1) f = n;
      |                    ^
cave.cpp:28:20: error: 'f' was not declared in this scope
   28 |                 if(f>e){
      |                    ^
cave.cpp:38:15: error: expected ';' before 'i'
   38 |         for(ll i = 0;i<n;i++){
      |               ^~
      |               ;
cave.cpp:38:22: error: 'i' was not declared in this scope
   38 |         for(ll i = 0;i<n;i++){
      |                      ^
cave.cpp:39:13: error: 'c' was not declared in this scope
   39 |             c[i]^=1;
      |             ^
cave.cpp:40:21: error: 'tryCombination' was not declared in this scope
   40 |             int e = tryCombination(c);
      |                     ^~~~~~~~~~~~~~
cave.cpp:41:13: error: 'b' was not declared in this scope
   41 |             b[i] = e;
      |             ^
cave.cpp:44:16: error: 'c' was not declared in this scope
   44 |         answer(c,b);
      |                ^
cave.cpp:44:18: error: 'b' was not declared in this scope
   44 |         answer(c,b);
      |                  ^
cave.cpp:44:9: error: 'answer' was not declared in this scope
   44 |         answer(c,b);
      |         ^~~~~~
cave.cpp:46:10: error: 'a' was not declared in this scope
   46 |     iota(a,a+n,0);
      |          ^
cave.cpp:46:5: error: 'iota' was not declared in this scope
   46 |     iota(a,a+n,0);
      |     ^~~~
cave.cpp:47:11: error: expected ';' before 'i'
   47 |     for(ll i = 0;i<n;i++){
      |           ^~
      |           ;
cave.cpp:47:18: error: 'i' was not declared in this scope
   47 |     for(ll i = 0;i<n;i++){
      |                  ^
cave.cpp:48:9: error: 'c' was not declared in this scope
   48 |         c[i] = 1;
      |         ^
cave.cpp:49:11: error: expected ';' before 'e'
   49 |         ll e = tryCombination(c);
      |           ^~
      |           ;
cave.cpp:50:12: error: 'e' was not declared in this scope
   50 |         if(e==-1) e = n;
      |            ^
cave.cpp:51:12: error: 'e' was not declared in this scope
   51 |         if(e>i) c[i] = 1;
      |            ^
cave.cpp:54:12: error: 'c' was not declared in this scope
   54 |     answer(c,a);
      |            ^
cave.cpp:54:5: error: 'answer' was not declared in this scope
   54 |     answer(c,a);
      |     ^~~~~~