제출 #767442

#제출 시각아이디문제언어결과실행 시간메모리
767442mousebeaver죄수들의 도전 (IOI22_prison)C++17
0 / 100
5 ms724 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; const int digits = 7; string ternary(int a) { string output = ""; for(int i = 0; i < digits; i++) { output = (char) ((int) '0' + (a%3)) + output; a /= 3; } return output; } std::vector<std::vector<int>> devise_strategy(int N) { vector<string> t(N); for(int i = 1; i <= N; i++) { t[i-1] = ternary(i); } int m = 24; vector<vector<int>> output(m+1, vector<int> (N+1)); for(int i = 0; i <= 5; i++) { //Inspect bag A: output[i][0] = 0; //Results: for(int j = 1; j <= N; j++) { output[i][j] = 7 + 3*i + (int) t[j-1][i] - (int) '0'; } } output[6][0] = 0; for(int i = 1; i <= N; i++) { if(t[i-1][6] == '1') { output[6][i] = -1; } else { output[6][i] = -2; } } for(int i = 7; i <= 24; i++) { output[i][0] = 1; int bit = (i-7)/3; int pre = (i-7)%3; for(int j = 1; j <= N; j++) { int post = (int) t[j-1][bit] - (int) '0'; if(pre < post) { output[i][j] = -1; } else if(pre == post) { output[i][j] = bit+1; } else { output[i][j] = -2; } } } return output; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...