제출 #302298

#제출 시각아이디문제언어결과실행 시간메모리
302298JovanK26동굴 (IOI13_cave)C++14
0 / 100
160 ms512 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int n,cur; int s[5001]; int d[5001]; bool vis[5001]; bool check(int x,int y) { for(int i=x;i<=y;i++) { if(vis[i])continue; s[i]^=1; } int q=tryCombination(s); for(int i=x;i<=y;i++) { if(vis[i])continue; s[i]^=1; } if(q>cur || q==-1)return 1; return 0; } void exploreCave(int N) { n=N; memset(s,0,sizeof(s)); memset(vis,0,sizeof(vis)); for(int i=0;i<n;i++) { cur=i; int q=tryCombination(s); if(q>cur || cur==-1) { for(int j=0;j<n;j++) { if(vis[j])continue; s[j]^=1; } } int l=0; int r=n-1; int m; while(l<r) { m=(l+r)/2; if(check(l,m)) { r=m; } else { l=m+1; } } vis[r]=1; d[r]=i; s[r]^=1; } answer(s,d) ; }
#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...