제출 #302309

#제출 시각아이디문제언어결과실행 시간메모리
302309JovanK26동굴 (IOI13_cave)C++14
0 / 100
157 ms444 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]=!s[i]; } int q=tryCombination(s); for(int i=x;i<=y;i++) { if(vis[i])continue; s[i]=!s[i]; } if(q>cur || q==-1)return 1; return 0; } void exploreCave(int N) { n=N; 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]=!s[j]; } } 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]=!s[r]; } 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...