Submission #1158280

#TimeUsernameProblemLanguageResultExecution timeMemory
1158280SofiatpcCave (IOI13_cave)C++20
13 / 100
248 ms540 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; const int MAXN =5005; int ans[MAXN], v[MAXN], s[MAXN]; void exploreCave(int n) { for(int i = 0; i < n; i++)ans[i] = -1; for(int i = 0; i < n; i++){ int l = 0, r = n-1; int x; for(int j = 0; j < n; j++){ if(ans[j] == -1)s[j] = 1; else s[j] = ans[j]; } int temp = tryCombination(s); if(temp > i || temp == -1)x = 1; else x = 0; while(l != r){ int mid = (l+r)/2; for(int j = 0; j <= mid; j++)s[j] = x; for(int j = mid+1; j < n; j++){ if(ans[j] == -1)s[j] = (x+1)%2; else s[j] = ans[j]; } temp = tryCombination(s); if(temp > i || temp == -1)r = mid; else l = mid+1; } ans[l] = x; v[l] = i; } answer(ans,v); }
#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...