Submission #289912

#TimeUsernameProblemLanguageResultExecution timeMemory
289912egekabasCave (IOI13_cave)C++14
21 / 100
7 ms512 KiB
#include "cave.h" #include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define ff first #define ss second #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<ull, ull> pull; typedef pair<int, int> pii; typedef pair<ld, ld> pld; int s[5009], d[5009]; int done[5009]; int fin = 0; void exploreCave(int N) { srand(time(NULL)); vector<int> v; for(int i = 0; i < N; ++i){ s[i] = rand()%2; v.pb(i); } int cur = tryCombination(s); if(cur == -1) cur = 1e9+7; while(fin < N){ //cout << fin << '\n'; random_shuffle(all(v)); for(auto u : v){ if(done[u]) continue; s[u] ^= 1; int newcur = tryCombination(s); if(newcur == -1) newcur = 1e9+7; if(newcur < cur){ s[u] ^= 1; done[u] = 1; d[u] = newcur; ++fin; } else if(newcur > cur){ done[u] = 1; d[u] = cur; cur = newcur; ++fin; } } } 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...