# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
76704 |
2018-09-16T03:36:35 Z |
liwi |
동굴 (IOI13_cave) |
C++11 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
using namespace std;
#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define println printf("\n");
#define readln(x) getline(cin,x);
#define pb push_back
#define endl "\n"
#define MOD 1000000007
#define mp make_pair
#define MAXN 5000
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef unordered_map<int,int> umii;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,pii> triple;
typedef int8_t byte;
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
ll fpow(ll b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
int num_switches,ans[MAXN],on[MAXN];
void exploreCave(int N){
num_switches = N;
for(int s=0; s<num_switches; s++){
int temp[MAXN];
for(int i=0; i<num_switches; i++)
temp[i] = 1;
int p = tryCombination(temp);
int low = 0, high = num_switches-1, last = p>=s||p==-1;
while(low <= high){
if(low == high){
ans[s] = low;
if(last) on[s] = temp[low];
else on[s] = !temp[low];
break;
}
int mid = (low+high)/2;
memset(temp,0,sizeof temp);
for(int i=low; i<=mid; i++)
temp[i] = 1;
p = tryCombination(temp);
p = (p>=s||p==-1);
if(p != last){
high = mid;
last = !last;
}else{
low = mid;
}
}
}
answer(on,ans);
}
int main(){
}
Compilation message
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:36:17: error: 'tryCombination' was not declared in this scope
int p = tryCombination(temp);
^~~~~~~~~~~~~~
cave.cpp:60:5: error: 'answer' was not declared in this scope
answer(on,ans);
^~~~~~
cave.cpp:60:5: note: suggested alternative: 'ans'
answer(on,ans);
^~~~~~
ans