Submission #821936

#TimeUsernameProblemLanguageResultExecution timeMemory
821936boyliguanhanPrisoner Challenge (IOI22_prison)C++17
65 / 100
9 ms1112 KiB
#include "prison.h" #include <vector> using namespace std; int pows[12]{4096,2048,1024,512,256,128,64,32,16,8,4,2}; vector<vector<int>> devise_strategy(int N) { int x = 24; vector<vector<int>> v(x+1,vector<int>(N+1)); v[0][0] = 0; for(int i = 1; i <= N; i++) { v[0][i] = (i >= 4096) + 1; } for(int i = 1; i <= x; i++) { int bit = i-1>>1, bitv = (i-1)%2; bool look = 1-bit%2; v[i][0] = look; for(int j = 1; j <= N; j++) { bool tbit = j&pows[bit]; if(tbit^bitv) { v[i][j] = -(look^tbit)-1; } else { if(bit==11) { v[i][j] = -!!(j&1)-1; } else { v[i][j] = 1+2+bit*2+(bool)(j&pows[bit]/2); } } } } return v; }

Compilation message (stderr)

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:14:16: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
   14 |     int bit = i-1>>1, bitv = (i-1)%2;
      |               ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...