Submission #856540

#TimeUsernameProblemLanguageResultExecution timeMemory
856540samek08Prisoner Challenge (IOI22_prison)C++17
30 / 100
20 ms3268 KiB
#include "prison.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(a,b) for (int a = 0; a < (b); ++a) #define pb push_back #define all(t) t.begin(), t.end() const int MAXM = 52; vector<vector<int>> wyn; vector<vector<int>> devise_strategy(int N) { wyn.assign(MAXM+1,{}); rep(i,MAXM+1) wyn[i].assign(N+1,-1); wyn[0][0] = 0; for(int i = 1; i <= N; ++i) { int b = ((1 << (12)) & i); if(b == 0) wyn[0][i] = 13; else wyn[0][i] = 26; } for(int i = 1; i <= MAXM; ++i) { int idx = i; bool czy_pochodzi_z_A = true, czy_zapalony_bit = false; if(idx > 26) { czy_pochodzi_z_A = false, idx -= 26; } if(idx > 13) { czy_zapalony_bit = true, idx -= 13; } if(czy_pochodzi_z_A) wyn[i][0] = 1; else wyn[i][0] = 0; for(int j = 1; j <= N; ++j) { int b = ((1 << (idx-1)) & j); if(czy_zapalony_bit and b == 0) { if(czy_pochodzi_z_A) wyn[i][j] = -2; else wyn[i][j] = -1; } else if(!czy_zapalony_bit and b > 0) { if(czy_pochodzi_z_A) wyn[i][j] = -1; else wyn[i][j] = -2; } else { int val = idx-1; if(czy_pochodzi_z_A) val += 26; int bit_spr = ((1 << (idx-2)) & j); if(bit_spr > 0) val += 13; wyn[i][j] = val; } } } /* for (int i = 0; i <= MAXM; ++i) { for(int j = 0; j <= N; ++j) cout << wyn[i][j] << " "; cout << '\n'; } */ return wyn; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...