Submission #755013

#TimeUsernameProblemLanguageResultExecution timeMemory
755013PiokemonPrisoner Challenge (IOI22_prison)C++17
65 / 100
13 ms1108 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; typedef long long int ll; vector<vector<int>> devise_strategy(int N) { vector<int> czesc (N+1,0); vector<vector<int>> odp (25,czesc); odp[0][0] = 0; for (int x=1;x<=N;x++) odp[0][x] = 1 + ((x & (1<<12))>0); for (int y=1;y<12;y++){ odp[2*y-1][0] = y%2; for (int x=1;x<=N;x++){ if (x&(1<<(12-y+1))) odp[2*y-1][x] = (y%2==0?-2:-1); else odp[2*y-1][x] = 2*y + 1 + ((x & (1<<(12-y)))>0); } odp[2*y-1][1] = (y%2==0?-1:-2); odp[2*y-1][N] = (y%2==0?-2:-1); odp[2*y-1][0] = y%2; for (int x=1;x<=N;x++){ if (!(x&(1<<(12-y+1)))) odp[2*y][x] = (y%2==0?-1:-2); else odp[2*y][x] = 2*y + 1 + ((x & (1<<(12-y)))>0); } odp[2*y][1] = (y%2==0?-1:-2); odp[2*y-1][N] = (y%2==0?-2:-1); odp[2*y][0] = y%2; } odp[23][0] = 0; for (int x=1;x<=N;x++){ if (x&2) odp[23][x] = -2; else odp[23][x] = (x&1?-2:-1); } odp[23][1] = -1; odp[23][N] = -2; odp[24][0] = 0; for (int x=1;x<=N;x++){ if (!(x&2)) odp[24][x] = -1; else odp[24][x] = (x&1?-2:-1); } odp[24][1] = -1; odp[24][N] = -2; /*for (int x=0;x<=24;x++){ for (int y=0;y<=N;y++) cout << odp[x][y] << ' '; cout << '\n'; }*/ return odp; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...