제출 #792277

#제출 시각아이디문제언어결과실행 시간메모리
792277MattTheNub죄수들의 도전 (IOI22_prison)C++17
0 / 100
5 ms852 KiB
#include "prison.h" #include <bits/stdc++.h> #include <vector> using namespace std; template <class T> using v = vector<T>; v<v<int>> ans; void construct(int i, int l, int r, int cur) { if (l == r) { return; } int m = (l + r) / 2; for (int j = l; j <= m; j++) { ans[i][j] = (i + 1) / 2 + 1; } for (int j = m + 1; j <= r; j++) { ans[i][j] = (i + 1) / 2 + 2; } construct((i + 1) / 2 + 1, l, m, 1 - cur); for (int j = m + 1; j <= r; j++) { ans[(i + 1) / 2 + 1][j] = -(1 - cur) - 1; } construct((i + 1) / 2 + 2, m + 1, r, 1 - cur); for (int j = l; j <= m; j++) { ans[(i + 1) / 2 + 2][j] = -cur - 1; } } v<v<int>> devise_strategy(int N) { ans.assign(__lg(2 * N) * 2 + 1, v<int>(N + 1)); for (int i = 0; i < ans.size(); i++) { ans[i][0] = ((i + 1) / 2) & 1; for (int j = 1; j <= N; j++) { ans[i][j] = -ans[i][0] - 1; } } construct(0, 1, N, 1); return ans; }

컴파일 시 표준 에러 (stderr) 메시지

prison.cpp: In function 'v<std::vector<int> > devise_strategy(int)':
prison.cpp:34:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   for (int i = 0; i < ans.size(); i++) {
      |                   ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...