제출 #849047

#제출 시각아이디문제언어결과실행 시간메모리
849047grossly_overconfident죄수들의 도전 (IOI22_prison)C++17
0 / 100
1 ms408 KiB
#include <bits/stdc++.h> using namespace std; int solve(int a){ return to_string(a).size(); } int find_digit(int a, int i){ return (to_string(a)[i] - 48); } vector<vector<int>> devise_strategy(int n){ int x = 100; vector<vector<int>> out(x, vector<int>(n + 1)); for (int i = 1; i <= n; ++i){ out[0][i] = solve(i); } for (int i = 1; i <= 4; ++i){ out[i][0] = 1; for (int j = 1; j <= n; ++j){ if (solve(j) > i){ out[i][j] = -1; continue; } if (solve(j) < i){ out[i][j] = -2; continue; } out[i][j] = 10 + find_digit(j, 0); } } for (int i = 10; i <= 19; ++i){ out[i][0] = 0; for (int j = 1; j <= n; ++j){ int k = find_digit(j, 0); if (k > i - 10){ out[i][j] = -2; continue; } if (k < i - 10){ out[i][j] = -1; continue; } out[i][j] = 20 + find_digit(j, 1); } } for (int i = 20; i <= 29; ++i){ out[i][0] = 1; for (int j = 1; j <= n; ++j){ int k = find_digit(j, 1); if (k > i - 20){ out[i][j] = -1; continue; } if (k < i - 20){ out[i][j] = -2; continue; } out[i][j] = 30 + find_digit(j, 2); } } for (int i = 30; i <= 39; ++i){ out[i][0] = 0; for (int j = 1; j <= n; ++j){ int k = find_digit(j, 2); if (k > i - 30){ out[i][j] = -2; continue; } if (k < i - 30){ out[i][j] = -1; continue; } out[i][j] = 40 + find_digit(j, 3); } } for (int i = 40; i <= 49; ++i){ out[i][0] = 1; for (int j = 1; j <= n; ++j){ int k = find_digit(j, 3); if (k > i - 40){ out[i][j] = -1; continue; } if (k < i - 40){ out[i][j] = -2; } } } return out; } //someone please tell me why this doesnt work lmao
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...