답안 #608800

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
608800 2022-07-27T10:16:47 Z Duy_e Monster Game (JOI21_monster) C++17
10 / 100
162 ms 704 KB
#include "monster.h"

using namespace std;

const long long N = 2e2 + 5;
int ans[N][N];
vector<int> Solve(int n) {

  	vector<int> T(n);
	
	int pos1 = 0, pos2 = 0;
    vector <int> p1, p2;

	for (int i = 0; i < n; i ++)
		for (int j = i + 1; j < n; j ++)
			ans[i][j] = Query(i, j), ans[j][i] = !ans[i][j];

	for (int i = 0; i < n; i ++) {
		for (int j = 0; j < n; j ++) 
			if (i != j) {
				T[i] += ans[i][j];
			}

		if (T[i] == 2) p1.push_back(i);
        if (T[i] == n - 3) p2.push_back(i);
    }

	for (int i = 0; i < n; i ++) {
        if (T[i] == 1) {
            T[i] = 0;
            for (int j: p1) if (ans[i][j]) T[i] = 1;
	    }

        if (T[i] == n - 2) {
            T[i] = n - 1;
            for (int j: p2) if (!ans[i][j]) T[i] = n - 2;
        }
    }

	return T;
}

Compilation message

monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:11:6: warning: unused variable 'pos1' [-Wunused-variable]
   11 |  int pos1 = 0, pos2 = 0;
      |      ^~~~
monster.cpp:11:16: warning: unused variable 'pos2' [-Wunused-variable]
   11 |  int pos1 = 0, pos2 = 0;
      |                ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 292 KB Output is correct
9 Correct 0 ms 292 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 114 ms 336 KB Output is correct
17 Correct 137 ms 432 KB Output is correct
18 Correct 160 ms 336 KB Output is correct
19 Correct 139 ms 336 KB Output is correct
20 Correct 162 ms 420 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 0 ms 208 KB Output is correct
24 Correct 0 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 119 ms 336 KB Output is correct
27 Correct 0 ms 208 KB Output is correct
28 Correct 0 ms 208 KB Output is correct
29 Correct 0 ms 208 KB Output is correct
30 Correct 0 ms 208 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 148 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 292 KB Output is correct
9 Correct 0 ms 292 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 114 ms 336 KB Output is correct
17 Correct 137 ms 432 KB Output is correct
18 Correct 160 ms 336 KB Output is correct
19 Correct 139 ms 336 KB Output is correct
20 Correct 162 ms 420 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 0 ms 208 KB Output is correct
24 Correct 0 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 119 ms 336 KB Output is correct
27 Correct 0 ms 208 KB Output is correct
28 Correct 0 ms 208 KB Output is correct
29 Correct 0 ms 208 KB Output is correct
30 Correct 0 ms 208 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 148 ms 336 KB Output is correct
33 Runtime error 2 ms 592 KB Execution killed with signal 11
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 704 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -