Submission #940430

#TimeUsernameProblemLanguageResultExecution timeMemory
940430SundavarMonster Game (JOI21_monster)C++17
10 / 100
106 ms420 KiB
#include "monster.h" #include <bits/stdc++.h> using namespace std; std::vector<int> Solve(int N) { std::vector<int> T(N); vector<int> cnt(N); vector<int> amb1, amb2; for(int i = 0; i < N; i++){ for(int j = 0; j < i; j++) if(j != i) if(Query(i,j)) cnt[i]++; else cnt[j]++; } for(int i = 0; i < N; i++){ if(cnt[i] == 1) amb1.push_back(i); if(cnt[i] == N-2) amb2.push_back(i); } (Query(amb1[0], amb1[1]) ? cnt[amb1[0]] : cnt[amb1[1]])--; (Query(amb2[0], amb2[1]) ? cnt[amb2[1]] : cnt[amb2[0]])++; for (int i = 0; i < N; i++) T[i] = cnt[i]; return T; }

Compilation message (stderr)

monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:11:34: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   11 |     for(int j = 0; j < i; j++) if(j != i)
      |                                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...