Submission #940430

# Submission time Handle Problem Language Result Execution time Memory
940430 2024-03-07T09:10:52 Z Sundavar Monster Game (JOI21_monster) C++17
10 / 100
106 ms 420 KB
#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

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 time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 86 ms 344 KB Output is correct
17 Correct 84 ms 344 KB Output is correct
18 Correct 79 ms 344 KB Output is correct
19 Correct 85 ms 344 KB Output is correct
20 Correct 87 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 84 ms 344 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 76 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 86 ms 344 KB Output is correct
17 Correct 84 ms 344 KB Output is correct
18 Correct 79 ms 344 KB Output is correct
19 Correct 85 ms 344 KB Output is correct
20 Correct 87 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 84 ms 344 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 76 ms 344 KB Output is correct
33 Incorrect 101 ms 416 KB Wrong Answer [6]
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 106 ms 420 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -