Submission #1060414

#TimeUsernameProblemLanguageResultExecution timeMemory
1060414nvujicaPrisoner Challenge (IOI22_prison)C++17
65 / 100
22 ms1180 KiB
#include <bits/stdc++.h> #include "prison.h" using namespace std; const int x = 24; vector<vector<int> > devise_strategy(int n) { vector <vector<int> > s(x + 1); for(int i = 0; i <= x; i++){ s[i].resize(n + 1, 0); } for(int i = 0; i <= x; i++){ int b = (i + 2) / 3; int r = (i + 2) % 3; s[i][0] = b % 2; for(int val = 1; val <= n; val++){ vector <int> mask; int val2 = val; while(val2){ mask.push_back(val2 % 3); val2 /= 3; } while(mask.size() < x / 3) mask.push_back(0); reverse(mask.begin(), mask.end()); // if(val == 6){ // for(int j = 0; j < mask.size(); j++){ // cout << mask[j]; // } // cout << endl; // } // // if(i == 4 && val == 3){ // // for(int j = 0; j < mask.size(); j++){ // cout << mask[j]; // } // cout << endl; // // cout << b << ' ' << mask[b] << ' ' << b * 3 + 1 + mask[b] << endl; // // } if(b == 0 || mask[b - 1] == r){ if(b < mask.size()) s[i][val] = b * 3 + 1 + mask[b]; } else if(mask[b - 1] < r){ s[i][val] = -1 - s[i][0]; // if(i == 4 && val == 3) cout << "tu sam" << endl; } else if(mask[b - 1] > r) s[i][val] = -2 + s[i][0]; } } // for(int i = 0; i <= x; i++){ // for(int j = 0; j <= n; j++){ // cout << s[i][j] << ' '; // } // cout << endl; // } return s; }

Compilation message (stderr)

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:53:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |     if(b < mask.size()) s[i][val] = b * 3 + 1 + mask[b];
      |        ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...