제출 #626205

#제출 시각아이디문제언어결과실행 시간메모리
626205ITO죄수들의 도전 (IOI22_prison)C++17
0 / 100
5 ms596 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> devise_strategy(int N) { vector<vector<int>> v(23, vector<int>(N + 1, 0)); int i = 0, j = 1667, zz = 1, jj; v[i][0] = 0; for (int k = 1; k <= N; k++) { v[i][k] = 1 + ((k / j) % 3); } for (i = 1; i < 10; i += 3) { jj = (j - 1) / 3 + 1; for (int k = 0; k < 3; k++) v[i + k][0] = zz; for (int k = 1; k <= N; k++) { int z = (k / j) % 3; for (int y1 = 0; y1 < 3; y1++) { if (y1 < z) v[i + y1][k] = -2+zz; else if (y1 > z) v[i + y1][k] = -1-zz; else v[i + y1][k] = i + 3 + ((k / jj) % 3); } } zz = 1 - zz; j = jj; } jj = (j - 1) / 2 + 1; for (int k = 0; k < 3; k++) v[i + k][0] = zz; for (int k = 1; k <= N; k++) { int z = (k / j) % 3; for (int y1 = 0; y1 < 3; y1++) { if (y1 < z) v[i + y1][k] = -2+zz; else if (y1 > z) v[i + y1][k] = -1-zz; else v[i + y1][k] = i + 3 + ((k / jj) % 2); } } zz = 1 - zz; j = jj; for (i = 13; i < 21; i += 2) { jj = (j - 1) / 2 + 1; for (int k = 0; k < 2; k++) v[i + k][0] = zz; for (int k = 1; k <= N; k++) { int z = (k / j) % 2; for (int y1 = 0; y1 < 2; y1++) { if (y1 < z) v[i + y1][k] = -2+zz; else if (y1 > z) v[i + y1][k] = -1-zz; else v[i + y1][k] = i + 2 + ((k / jj) % 2); } } zz = 1 - zz; j = jj; } jj = (j - 1) / 2 + 1; for (int k = 0; k < 2; k++) v[i + k][0] = zz; for (int k = 1; k <= N; k++) { int z = (k / j) % 2; for (int y1 = 0; y1 < 2; y1++) { if (y1 < z) v[i + y1][k] = -2+zz; else if (y1 > z) v[i + y1][k] = -1-zz; else if (k / jj % 2 == 1) v[i + y1][k] = -2+zz; else v[i + y1][k] = -1-zz; } } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...