Submission #701202

#TimeUsernameProblemLanguageResultExecution timeMemory
701202mychecksedadCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

void answer(int S[], int D[]);
int tryCombination(int S[]);

void exploreCave(int N) {
    int s[N], a[N], b[N], C[N], d[N];
    vector<bool> vis(N, 0);
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < N; ++j) if(!vis[j]) s[j] = 0;
        int f = tryCombination(s);
        if(f > i || f == -1){
            a[i] = 0;
        }else{
            a[i] = 1;
        }
        int l = 1, r = N - i;
        C[i] = 1;
        while(l <= r){
            int mid = l+r>>1;
            for(int j = 0, c = 0; j < N; ++j){
              if(!vis[j]){
            		c++;
                if(c >= l && c <= mid)
                  s[j] = a[i];
                else if(c > mid && c <= r)
                  s[j] = !a[i];
                else
              		s[j] = !a[i];  	
              }
            }
            int f = tryCombination(s);
            if(f > i || f == -1){
              C[i] = mid;
              r = mid - 1;
            }else{
              l = mid + 1;
            }
        }
        for(int j = 0, c = 0; j < N; ++j){
        	if(!vis[j]){
        		c++;
        		if(c == C[i]){
        			C[i] = j;
        			break;
        		}
        	}
        }
        s[C[i]] = a[i];
        vis[C[i]] = 1;
    }   
    for(int i = 0; i < N; ++i) b[C[i]] = i;
    for(int i = 0; i < N; ++i) d[C[i]] = a[i];

    answer(d, b);
}



#ifdef __cplusplus
#endif

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:21:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   21 |             int mid = l+r>>1;
      |                       ~^~
/usr/bin/ld: /tmp/ccFbcNGG.o: in function `exploreCave(int)':
cave.cpp:(.text+0x210): undefined reference to `answer(int*, int*)'
/usr/bin/ld: cave.cpp:(.text+0x330): undefined reference to `tryCombination(int*)'
/usr/bin/ld: cave.cpp:(.text+0x3ee): undefined reference to `tryCombination(int*)'
/usr/bin/ld: /tmp/ccATsUaD.o: in function `main':
grader.c:(.text.startup+0x10): undefined reference to `exploreCave'
collect2: error: ld returned 1 exit status