# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
17214 |
2015-11-08T09:24:04 Z |
murat |
Cave (IOI13_cave) |
C++ |
|
0 ms |
0 KB |
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;
const int N = 5001;
int S[N], go[N], col[N], h[N];
inline int find(int bas, int son, int ccc, int ind) {
if(bas == son) return bas;
int orta = bas + son >> 1;
for(int j = bas; j <= orta; j++)
if(h[j]) S[j] = col[j];
else S[j] = ccc;
for(int j = orta + 1; j <= son; j++)
if(h[j]) S[j] = col[j];
else S[j] = !ccc;
if(tryCombination(S) != ind)
return find(bas, orta, ccc, ind);
return find(orta+1, son, ccc, ind);
}
void exporeCave(int N) {
for(int i = 0; i < N; i++) {
for(int j = 0; j < N; j++)
if(h[j]) S[j] = col[j];
else S[j] = 0;
int ccc = 0;
if(tryCombination(S) == i)
ccc = 1;
int index = find(0, N - 1, ccc, i);
h[index] = 1;
go[index] = i;
col[index] = ccc;
}
answer(col, go);
return ;
}
Compilation message
cave.cpp: In function 'int find(int, int, int, int)':
cave.cpp:12:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
int orta = bas + son >> 1;
~~~~^~~~~
/tmp/ccjmKJzU.o: In function `main':
grader.c:(.text.startup+0xc): undefined reference to `exploreCave'
collect2: error: ld returned 1 exit status