Submission #627148

#TimeUsernameProblemLanguageResultExecution timeMemory
627148haojiandanPrisoner Challenge (IOI22_prison)C++17
65 / 100
13 ms1096 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; int Get(int x) { if (x==0) return -1; return -2; } int Q(int x,int i) { for (int j=0;j<i;j++) x/=3; return x%3; } vector<vector<int>> devise_strategy(int n) { vector<vector<int> > res(25,vector<int>(n+1)); res[0][0]=0; for (int i=1;i<=n;i++) res[0][i]=Q(i,7)+1; for (int i=1;i<=24;i++) { int bit=7-(i+2)/3+1; res[i][0]=(i%6==0||i%6==5||i%6==4?0:1); int lst=(i%3-1+3)%3; int nxt; if (i%3==0) nxt=i+1; else if (i%3==2) nxt=i+2; else nxt=i+3; for (int j=1;j<=n;j++) { int now=Q(j,bit); if (now!=lst) { if (now<lst) res[i][j]=Get(res[i][0]); else res[i][j]=Get(res[i][0]^1); } else { res[i][j]=nxt+Q(j,bit-1); res[i][j]=min(res[i][j],24); } } } /*for (int i=0;i<=26;i++) { for (int j=1;j<=n;j++) printf("%d ",res[i][j]); puts(""); }*/ return res; }

Compilation message (stderr)

prison.cpp: In function 'int Get(int)':
prison.cpp:5:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
    5 |  if (x==0) return -1; return -2;
      |  ^~
prison.cpp:5:23: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
    5 |  if (x==0) return -1; return -2;
      |                       ^~~~~~
prison.cpp: In function 'int Q(int, int)':
prison.cpp:8:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    8 |  for (int j=0;j<i;j++) x/=3; return x%3;
      |  ^~~
prison.cpp:8:30: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
    8 |  for (int j=0;j<i;j++) x/=3; return x%3;
      |                              ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...