Submission #846907

#TimeUsernameProblemLanguageResultExecution timeMemory
846907AbitoMonster Game (JOI21_monster)C++17
0 / 100
2 ms600 KiB
#include "monster.h" #include <bits/stdc++.h> #define elif else if #define pb push_back using namespace std; const int N=205; int n,s[N],in[N],out[N]; bool b[N][N],adj[N][N]; namespace { bool example_variable; } // namespace int res(int x,int y){ if (abs(x-y)==1) return x<y; return x>y; } std::vector<int> Solve(int N) { n=N; for (int i=0;i<n;i++){ for (int j=i+1;j<n;j++){ b[i][j]=Query(i,j); b[j][i]=!b[i][j]; } } if (n==4){ vector<int> a={0,1,2,3}; do{ bool ok=true; for (int i=0;i<n;i++){ for (int j=i+1;j<n;j++){ if (res(a[i],a[j])==b[i][j]) continue; ok=false; } } if (!ok) continue; return a; }while (next_permutation(a.begin(),a.end())); } for (int i=0;i<n;i++){ for (int j=0;j<n;j++){ if (!b[i][j]) continue; for (int k=0;k<n;k++){ if (!b[i][k] || !b[k][j]) continue; adj[i][j]=true; in[j]++; out[i]++; //cout<<i<<' '<<k<<' '<<j<<endl; break; } } } for (int i=0;i<n;i++) s[i]=out[i]+1; for (int i=0;i<n;i++){ for (int j=i+1;j<n;j++){ if (out[i]!=out[j]) continue; if (in[i]<in[j]) s[j]--; else s[i]--; } }vector<int> ans; for (int i=0;i<n;i++) cout<<in[i]<<' '<<out[i]<<endl; for (int i=0;i<n;i++) ans.pb(s[i]); for (auto u:ans) cout<<u<<' ';cout<<endl; return ans; }

Compilation message (stderr)

monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:63:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   63 |     for (auto u:ans) cout<<u<<' ';cout<<endl;
      |     ^~~
monster.cpp:63:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   63 |     for (auto u:ans) cout<<u<<' ';cout<<endl;
      |                                   ^~~~
monster.cpp: At global scope:
monster.cpp:11:6: warning: '{anonymous}::example_variable' defined but not used [-Wunused-variable]
   11 | bool example_variable;
      |      ^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...