제출 #650950

#제출 시각아이디문제언어결과실행 시간메모리
650950Litusiano동굴 (IOI13_cave)C++14
12 / 100
412 ms388 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; #define MAX_N 5000 int v[MAX_N]; bool used[MAX_N]; void convert(int idx, int val){ for(int i = 0; i<= idx; i++){ if(used[i]) continue; v[i] = val; } } void exploreCave(int N) { /* ... */ //int v[N]; for(int i = 0; i<N; i++){ v[i] = 0; } int s[N]; // Busco combinacio correcte for(int i = 0; i<N; i++){ bool ok = 0; int l = -1; int r = N-1; int val = 0; convert(N,0); if(i == 2){ /*cout<<"V "; for(int i = 0; i<N; i++) cout<<v[i]<<" "; cout<<endl;*/ } if(tryCombination(v) == i) val = 1; convert(N,val^1); while(r > l+1){ int m = (l+r)/2; convert(m,val); // si s'ha obert, int x = tryCombination(v); if(x == i){ //tancat l = m; } else r = m; convert(m,val^1); } if(ok) break; //cout<<i<<" "<<l<<" "<<r<<" "<<val<<endl; used[r] = 1; v[r] = val; s[i] = r; } /*int idx = 0; for(int i = 0; i<N;i++){ if(!used[i]) idx = i; } v[idx] = 0; if(tryCombination(v) != -1) v[idx] = 1; for(int i = 0; i<N; i++){ v[i] ^= 1; s[i] = tryCombination(v); v[i] ^= 1; }*/ answer(v,s); //for(int i = 0; i<N; i++) cout<<v[i]<<" "; cout<<endl; //for(int i = 0; i<N; i++) cout<<s[i]<<" "; cout<<endl; return; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...