Submission #692875

#TimeUsernameProblemLanguageResultExecution timeMemory
692875PyqePrisoner Challenge (IOI22_prison)C++17
80 / 100
13 ms1108 KiB
#include <bits/stdc++.h> #include "prison.h" using namespace std; const long long mm=8,z=22; long long pw3[mm+1]; vector<vector<int>> devise_strategy(int n) { long long i,j,k,l,e,w,w2; vector<int> cv; vector<vector<int>> cvv; pw3[0]=1; for(i=1;i<=mm;i++) { pw3[i]=pw3[i-1]*3; } for(i=0;i<=z;i++) { k=mm-(i+2)/3; l=-1; if(k<mm) { if(!k) { l=1; } else { l=(i-1)%3; } } e=k%2; cv.clear(); cv.push_back(e); for(j=1;j<=n;j++) { w=j/pw3[k]%3; if(k-1>=0) { w2=j/pw3[k-1]%3; } if(l!=-1&&w!=l) { if(w<l) { cv.push_back(-1ll-e); } else { cv.push_back(-1ll-!e); } } else if(k==1) { if(!w2) { cv.push_back(-1ll-e); } else if(w2==2) { cv.push_back(-1ll-!e); } else { cv.push_back((mm-k)*3+1); } } else { cv.push_back(min((mm-k)*3+1+w2,z)); } } cvv.push_back(cv); } return cvv; }

Compilation message (stderr)

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:73:32: warning: 'w2' may be used uninitialized in this function [-Wmaybe-uninitialized]
   73 |     cv.push_back(min((mm-k)*3+1+w2,z));
      |                      ~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...