제출 #1060444

#제출 시각아이디문제언어결과실행 시간메모리
1060444nvujica죄수들의 도전 (IOI22_prison)C++17
80 / 100
17 ms1112 KiB
#include <bits/stdc++.h> #include "prison.h" using namespace std; const int x = 22; vector<vector<int> > devise_strategy(int n) { vector <vector<int> > s(x + 1); for(int i = 0; i <= x; i++){ s[i].resize(n + 1, 0); } for(int i = 0; i <= x; i++){ int b = (i + 2) / 3; int r = (i + 2) % 3; s[i][0] = b % 2; for(int val = 1; val <= n; val++){ vector <int> mask; int val2 = val; while(val2){ mask.push_back(val2 % 3); val2 /= 3; } while(mask.size() < 8) mask.push_back(0); reverse(mask.begin(), mask.end()); if(b == 8){ if(mask[7] == 0) s[i][val] = -1; else s[i][val] = -2; continue; } if(b == 0 || mask[b - 1] == r){ if(b == 7){ if(mask[b] == 0) s[i][val] = -2; else if(mask[b] == 2) s[i][val] = -1; else s[i][val] = 22; } else s[i][val] = b * 3 + 1 + mask[b]; } else if(mask[b - 1] < r){ s[i][val] = -1 - s[i][0]; } else if(mask[b - 1] > r) s[i][val] = -2 + s[i][0]; } } // for(int i = 0; i <= x; i++){ // for(int j = 0; j <= n; j++){ // cout << s[i][j] << ' '; // } // cout << endl; // } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...