Submission #1061166

#TimeUsernameProblemLanguageResultExecution timeMemory
1061166sleepntsheepMonster Game (JOI21_monster)C++17
0 / 100
1 ms740 KiB
#include "monster.h" using namespace std; namespace { } vector<int> Solve(int N) { static int a[201][201], w[201], l[201]; for (int i = 0; i < N; ++i) w[i] = 0, l[i] = 0; for (int i = 0; i < N; ++i) for (int j = i + 1; j < N; ++j) { a[i][j] = Query(i, j); if (a[i][j]) ++w[i]; else ++w[j]; a[j][i] = !a[i][j]; } int x1 { -1 }, x2; for (int i = 0; i < N; ++i) { if (w[i] == 1) { if (~x1) x2 = i; else x1 = i; } } vector<int> T(N), taken(N), Q(N); if (a[x1][x2]) T[0] = x1, T[1] = x2; else T[0] = x2, T[1] = x1; taken[x1] = taken[x2] = 1; for (int j = 2; j < N; ++j) { for (int i = 0; i < N; ++i) if (not taken[i]) { if (a[T[j - 1]][i]) { T[j] = i; break; } } } for (int i = 0; i < N; ++i) Q[T[i]] = i; return Q; }

Compilation message (stderr)

monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:8:35: warning: variable 'l' set but not used [-Wunused-but-set-variable]
    8 |   static int a[201][201], w[201], l[201];
      |                                   ^
monster.cpp:29:23: warning: 'x2' may be used uninitialized in this function [-Wmaybe-uninitialized]
   29 |   taken[x1] = taken[x2] = 1;
      |                       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...