Submission #836124

#TimeUsernameProblemLanguageResultExecution timeMemory
836124tengiz05Prisoner Challenge (IOI22_prison)C++17
30 / 100
23 ms2004 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> devise_strategy(int n) { vector<vector<int>> f(13 * 4, vector<int>(n + 1)); for (int i = 0; i < 13 * 4; i++) { int num = 12 - (i >> 2); int A = i & 1; int res = i >> 1 & 1; if (A == 0) { f[i][0] = 0; for (int j = 1; j <= n; j++) { int bit = j >> num & 1; f[i][j] = ((12 - num) << 2) | (bit << 1) | 1; } } if (A == 1) { f[i][0] = 1; for (int j = 1; j <= n; j++) { int bit = j >> num & 1; if (bit == res) { f[i][j] = (12 - num + 1) << 2; } else { if (res < bit) { f[i][j] = -1; } else { f[i][j] = -2; } } } } } for (int i = 0; i < f.size(); i++) { for (int j = 0; j <= n; j++) { if (f[i][j] >= 13 * 4) f[i][j] = 0; // cout << f[i][j] << " \n"[j == n]; } } return f; }

Compilation message (stderr)

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