제출 #749100

#제출 시각아이디문제언어결과실행 시간메모리
749100LIF동굴 (IOI13_cave)C++14
51 / 100
128 ms404 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; int s[5005]; int state[5005]; int now[5005]; int last[5005]; int mp[5005]; void exploreCave(int N) { for(int i=0;i<N;i++) { int l = 0; int r = N-1; int xx = tryCombination(s); if(xx != i) now[i] = true; else now[i] = false; // cout<<"pre"<<" "<<now[i]<<endl; // cout<<"i"<<i<<endl; while(l<=r) { // cout<<"l r"<<l<<" "<<r<<endl; if(l == r) { int xx = tryCombination(s); if(xx == i) { s[l] ^=1; } break; } int mid = (l+r)>>1; for(int j=l;j<=mid;j++) { if(state[j] == false)s[j] ^= 1; } int xx = tryCombination(s); // cout<<"xx"<<xx<<endl; bool flag = false; if(xx != i)flag = true; // cout<<"flag"<<flag<<endl; if(now[i] == flag) { // cout<<"yeah"<<endl; l = mid+1; } else { r = mid; } now[i] = flag; } // cout<<l<<endl; state[l] = true; mp[l] = i; /* for(int j=0;j<N;j++) { cout<<s[j]<<" "; } cout<<endl;*/ } answer(s,mp); 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...