제출 #1004042

#제출 시각아이디문제언어결과실행 시간메모리
1004042Luvidi동굴 (IOI13_cave)C++17
100 / 100
406 ms600 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int f(int x){ if(x==-1)return 1e9; return x; } void exploreCave(int n) { int ans1[n],ans2[n]; memset(ans2,-1,sizeof(ans2)); for(int i=0;i<n;i++){ int a[n],x,y; for(int j=0;j<n;j++){ if(ans2[j]==-1)a[j]=0; else a[j]=ans1[j]; } x=tryCombination(a); y=x!=i; for(int j=0;j<n;j++){ if(ans2[j]==-1)a[j]=y; else a[j]=ans1[j]; } int l=0,r=n-1; while(l<r){ int m=(l+r)/2; for(int j=0;j<n;j++){ if(ans2[j]==-1)a[j]=y^(j<=m); else a[j]=ans1[j]; } if(f(tryCombination(a))>i)r=m; else l=m+1; } ans1[l]=y^1; ans2[l]=i; } answer(ans1,ans2); }
#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...