Submission #951342

#TimeUsernameProblemLanguageResultExecution timeMemory
951342quanlt206Cave (IOI13_cave)C++17
46 / 100
14 ms556 KiB
#include "cave.h" #include<bits/stdc++.h> #define X first #define Y second #define all(x) begin(x), end(x) #define FOR(i, a, b) for(int i = (a); i <= (b); i++) #define FORD(i, b, a) for(int i = (b); i >= (a); i--) #define REP(i, a, b) for (int i = (a); i < (b); i++) #define mxx max_element #define mnn min_element #define SQR(x) (1LL * (x) * (x)) #define MASK(i) (1LL << (i)) #define Point Vector #define left Left #define right Right #define div Div using namespace std; typedef long long ll; typedef unsigned long long ull; typedef double db; typedef long double ld; typedef pair<db, db> pdb; typedef pair<ld, ld> pld; typedef pair<int, int> pii; typedef pair<int, pii> piii; typedef pair<ll, ll> pll; typedef pair<ll, pll> plll; typedef pair<ll, int> pli; typedef pair<ll, pii> plii; template<class A, class B> bool maximize(A& x, B y) { if (x < y) return x = y, true; else return false; } template<class A, class B> bool minimize(A& x, B y) { if (x > y) return x = y, true; else return false; } /* END OF TEMPLATE */ const int N = 5e3 + 7; int n, s[N], d[N]; int a[N], b[N]; void subtask_1() { REP(i, 0, n) a[i] = i, b[i] = 0; REP(i, 0, n) { int val = tryCombination(b); if (val > i || val == -1) continue; b[i]^=1; } if (tryCombination(b) != -1) return ; answer(b, a); exit(0); } void subtask_2() { REP(i, 0, n) b[i] = 0; if (tryCombination(b) != -1) return ; REP(i, 0, n) { b[i]^=1; int vcl = tryCombination(b); a[i] = vcl; b[i]^=1; } answer(b, a); exit(0); } void subtask_3() { REP(i, 0, n) b[i] = 0; int tmp = tryCombination(b); while (tmp != -1) { REP(j, 0, n) { b[j]^=1; int vcl = tryCombination(b); if (vcl == -1 || vcl > tmp) { tmp = vcl; break; } b[j]^=1; } } REP(i, 0, n) { b[i]^=1; int vcl = tryCombination(b); a[i] = vcl; b[i]^=1; } answer(b, a); exit(0); } void exploreCave(int N) { n = N; if (n <= 100) { subtask_3(); return ; } subtask_2(); subtask_1(); return ; }
#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...