Submission #1277379

#TimeUsernameProblemLanguageResultExecution timeMemory
1277379almazCave (IOI13_cave)C++20
0 / 100
2096 ms332 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; // #define int long long // #define endl '\n' #define ff first #define ss second #define pb push_back #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define ar array const int MOD = 1e9 + 7,INF = 1e9, N = 2e5 + 5; /* */ void exploreCave(int n){ int ans[n], s[n], st[n]; for(int i = 0;i < n;i++){ ans[i] = 0; } for(int i = 0;i < n;i++){ int v = 1; int x = tryCombination(ans); if(x > i || x == -1){ v = 0; for(int i = 0;i < n;i++){ if(st[i]) continue; ans[i] = 1 - ans[i]; } x = i; } int l = 0, r = n - 1; int a = -1; while(l < r){ int m = (l + r) >> 1; for(int i = l;i <= m;i++){ if(st[i]) continue; ans[i] = 1 - ans[i]; } int y = tryCombination(ans); for(int i = l;i <= m;i++){ if(st[i]) continue; ans[i] = 1 - ans[i]; } if(y > x){ r = m - 1; a = m; } else{ l = m + 1; } } s[a] = i; st[a] = 1; ans[a] = v; } int x = tryCombination(ans); if(x != -1){ while(true); } answer(ans, s); }
#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...