Submission #846908

#TimeUsernameProblemLanguageResultExecution timeMemory
846908AbitoMonster Game (JOI21_monster)C++17
10 / 100
118 ms1112 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]++; 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++) ans.pb(s[i]); return ans; }

Compilation message (stderr)

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...