Submission #60879

#TimeUsernameProblemLanguageResultExecution timeMemory
60879updown1Cave (IOI13_cave)C++17
0 / 100
2098 ms480 KiB
/* Brute force w/ random to eliminate worse case scenarios */ //#include "grader.h" #include "cave.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define For(i, a, b) for(int i=a; i<b; i++) #define ffi For(i, 0, N) #define ffj For(j, 0, P) #define ffa ffi ffj #define s <<" "<< #define c <<" : "<< #define w cout #define e endl #define pb push_back #define mp make_pair #define a first #define b second //#define int ll //500,000,000 operations void exploreCave(int N) { srand (time(NULL)); int S[N], D[N]; bool done[N], dd1[N]; ffi S[i] = 0, done[i] = dd1[i] = false; int farprev = tryCombination(S); int diff = 0; S[0] = 1; int far = tryCombination(S); bool good = false; while (!good) { /// React to the difference if (far < farprev) {S[diff] = 1-S[diff]; done[diff] = true; D[diff] = far; ffi dd1[i] = false;} else if (far > farprev) {done[diff] = true; D[diff] = farprev; ffi dd1[i] = false;} while (dd1[diff] || done[diff]) { diff += rand(); diff %= N; } dd1[diff] = true; farprev = far; far = tryCombination(S); good = true; ffi if (!done[i]) good = false; } 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...