Submission #1195243

#TimeUsernameProblemLanguageResultExecution timeMemory
1195243ByeWorldPrisoner Challenge (IOI22_prison)C++20
65 / 100
8 ms1732 KiB
#include "prison.h" #include <bits/stdc++.h> #define ll long long #define fi first #define se second #define pb push_back using namespace std; typedef pair<ll,ll> pii; typedef pair<ll,pii> ipii; const int MAXN = 3e5+100; const ll INF = 2e18+10; const int LOG = 12; int n; vector<vector<int>> ANS; vector<int> vec; int cekbit(int n, int v){ int p = 1; for(int i=0; i<v; i++) p *= 9; return (n/p)%9; } int type(int n, int v){ return cekbit(n,v)/3; } std::vector<std::vector<int>> devise_strategy(int N) { n = N; // i = 0 vec.pb(0); for(int j=1; j<=n; j++){ vec.pb(type(j, 3)+6*(3) + 1); } ANS.pb(vec); for(int i=1; i<=24; i++){ // di papan i int v = i-1; int bit = v/6, num = v%6; vector<int> vec; if(num<=2){ // 0 1 2, group A nya // buka B vec.pb(1); for(int j=1; j<=n; j++){ int ty = type(j,bit); if(ty < num) vec.pb(-2); // b lebih dikit else if(ty > num) vec.pb(-1); // a lebih dikit else vec.pb(cekbit(j, bit)%3+6*bit+3 + 1); // +0 +1 +2 } } else { // buka A num -= 3; vec.pb(0); for(int j=1; j<=n; j++){ if(cekbit(j,bit)%3 == num){ // kalo sama if(type(j, bit-1)+6*(bit-1) + 1 < 0) vec.pb(-1); else vec.pb(type(j, bit-1)+6*(bit-1) + 1); // kalo coin segini } else if(cekbit(j,bit)%3 > num){ // A lebih gede vec.pb(-2); } else { vec.pb(-1); } } } ANS.pb(vec); // for(auto in : vec) cout << in << ' '; // cout << " in\n"; } return ANS; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...