제출 #836754

#제출 시각아이디문제언어결과실행 시간메모리
836754Abrar_Al_Samit죄수들의 도전 (IOI22_prison)C++17
65 / 100
10 ms1108 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> devise_strategy(int N) { vector<vector<int>>s(25, vector<int>(N+1)); s[0][0] = 0; //p 0 bag A for(int j=1; j<=N; ++j) { if(j >> 12 & 1) { s[0][j] = 2; } else { s[0][j] = 1; } } for(int i=1; i<25; ++i) { int cbit = 13 - (i + 1) / 2; if(i & 1) { //off if(i % 4 == 1) { //A s[i][0] = 1; for(int j=1; j<=N; ++j) { if(j >> cbit & 1) { s[i][j] = -1; } else { if(cbit==1) { if(j & 1) s[i][j] = -1; else s[i][j] = -2; continue; } s[i][j] = i + 2 + (j >> (cbit-1) & 1); } } } else { //B s[i][0] = 0; for(int j=1; j<=N; ++j) { if(j >> cbit & 1) { s[i][j] = -2; } else { if(cbit==1) { if(j & 1) s[i][j] = -2; else s[i][j] = -1; continue; } s[i][j] = i + 2 + (j >> (cbit-1) & 1); } } } } else { //on if(i % 4 == 2) { //A s[i][0] = 1; for(int j=1; j<=N; ++j) { if(j >> cbit & 1) { if(cbit==1) { if(j & 1) s[i][j] = -1; else s[i][j] = -2; continue; } s[i][j] = i + 1 + (j >> (cbit-1) & 1); } else { s[i][j] = -2; } } } else { //B s[i][0] = 0; for(int j=1; j<=N; ++j) { if(j >> cbit & 1) { if(cbit==1) { if(j & 1) s[i][j] = -2; else s[i][j] = -1; continue; } s[i][j] = i + 1 + (j >> (cbit-1) & 1); } else { s[i][j] = -1; } } } } } for(int i=0; i<25; ++i) { for(int j=0; j<=N; ++j) { if(s[i][j]>24) s[i][j] = 0; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...