# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
76699 | liwi | Cave (IOI13_cave) | C++11 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 5001
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=1; s<=num_switches; s++){
int temp[MAXN];
for(int i=1; i<=num_switches; i++)
temp[i] = 1;
int low = 1, high = num_switches, last = tryCombination(temp)>=s;
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;
if((tryCombination(temp)>=s) != last){
high = mid;
last = !last;
}else{
low = mid;
}
}
}
}
void answer(int S[MAXN],int D[MAXN]){
memcpy(S,on,sizeof on);
memcpy(D,ans,sizeof ans);
}
int main(){
}