Submission #855656

#TimeUsernameProblemLanguageResultExecution timeMemory
855656jamkelPrisoner Challenge (IOI22_prison)C++17
80 / 100
10 ms1168 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; #define st first #define nd second vector<vector<int>> devise_strategy(int N) { int n=N; vector<pair<int,int>>a(23);a={{0,0},{1,0},{2,0},{3,0},{4,0},{5,0},{6,0},{7,0},{1,1},{2,1},{3,1},{4,1},{5,1},{6,1}, {7,1},{8,1},{1,2},{2,2},{3,2},{4,2},{5,2},{6,2},{7,2}}; vector<vector<int>> b(23,vector<int>(n+1)); vector<vector<int>>t(n+1,vector<int>(9)); for(int i=0;i<t.size();i++) { t[i][8]=i; for(int j=8;j>0;j--) { t[i][j-1]=t[i][j]/3; t[i][j]%=3; } } for(int i=0;i<23;i++) { b[i][0]=a[i].st%2; for(int j=1;j<=n;j++) { if(a[i].nd>t[j][a[i].st]) { b[i][j]=b[i][0]*(-1)-1; } if(a[i].nd<t[j][a[i].st]) { b[i][j]=b[i][0]-2; } if(a[i].nd==t[j][a[i].st]) { if(t[j][a[i].st+1]==0) { b[i][j]=a[i].st+1; if(a[i].st+1==8) { b[i][j]=b[i][0]*(-1)-1; } } if(t[j][a[i].st+1]==1) { b[i][j]=a[i].st+8; } if(t[j][a[i].st+1]==2) { b[i][j]=a[i].st+16; if(a[i].st+1==8) { b[i][j]=b[i][0]-2; } } } } } return b; }

Compilation message (stderr)

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