Submission #812513

#TimeUsernameProblemLanguageResultExecution timeMemory
812513kwongwengPrisoner Challenge (IOI22_prison)C++17
56 / 100
12 ms1196 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef long double ld; typedef pair<ll, ll> pll; #define FOR(i, a, b) for(int i = a; i < b; i++) #define ROF(i, a, b) for(int i = a; i >= b; i--) #define ms memset #define pb push_back #define fi first #define se second vector<vi> devise_strategy(int N) { vector<vi> ans; // i=0 vi ans0(N+1); FOR(i,1,N+1){ if ((i&(1<<12)) != 0) ans0[i]=1; else ans0[i]=2; } ans.pb(ans0); // i=1 to x FOR(i,1,13){ vi ans1(N+1); // if bit is on vi ans2(N+1); // if bit is off ans1[0] = (i%2); ans2[0] = (i%2); FOR(j,1,N+1){ if ((j&(1<<(13-i))) != 0){ if ((j&(1<<(12-i))) != 0) ans1[j] = 2*i+1; else ans1[j] = 2*i+2; ans2[j] = (i%2) - 2; // person i%2 wins }else{ ans1[j] = -1 - (i%2); // per if ((j&(1<<(12-i))) != 0) ans2[j] = 2*i+1; else ans2[j] = 2*i+2; } } ans.pb(ans1); ans.pb(ans2); } vi ans1(N+1), ans2(N+1); ans1[0]=1; ans2[0]=1; FOR(i,1,N+1){ if (i%2==1){ ans2[i]=-1; }else{ ans1[i]=-2; } } ans.pb(ans1); ans.pb(ans2); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...