답안 #540121

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
540121 2022-03-19T09:38:50 Z rk42745417 Monster Game (JOI21_monster) C++17
10 / 100
184 ms 300 KB
#include "monster.h"
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(0);
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using ld = long double;
const int INF = 0x3f3f3f3f;
const ll LINF = ll(4e18) + ll(2e15);
const int MOD = 1e9 + 7;
const double EPS = 1e-9;

namespace {

bool example_variable;

}  // namespace

vector<int> Solve(int n) {
	vector<int> cnt(n);
	for(int i = 0; i < n; i++)
		for(int j = i + 1; j < n; j++) {
			if(Query(i, j))
				cnt[i]++;
			else
				cnt[j]++;
		}
	vector<int> ans(n);
	for(int i = 0; i < n; i++) {
		if(cnt[i] == 1 || cnt[i] == n - 2)
			continue;
		ans[i] = cnt[i];
	}

	{
		int a = -1, b;
		for(int i = 0; i < n; i++) {
			if(cnt[i] == 1) {
				if(~a)
					b = i;
				else
					a = i;
			}
		}
		if(Query(a, b))
			ans[a] = 0, ans[b] = 1;
		else
			ans[a] = 1, ans[b] = 0;
	}
	{
		int a = -1, b;
		for(int i = 0; i < n; i++) {
			if(cnt[i] == n - 2) {
				if(~a)
					b = i;
				else
					a = i;
			}
		}
		if(Query(a, b))
			ans[a] = n - 2, ans[b] = n - 1;
		else
			ans[a] = n - 1, ans[b] = n - 2;
	}
	return ans;
}

Compilation message

monster.cpp:17:6: warning: '{anonymous}::example_variable' defined but not used [-Wunused-variable]
   17 | bool example_variable;
      |      ^~~~~~~~~~~~~~~~
monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:62:11: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   62 |   if(Query(a, b))
      |      ~~~~~^~~~~~
monster.cpp:47:11: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   47 |   if(Query(a, b))
      |      ~~~~~^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 292 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 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 118 ms 292 KB Output is correct
17 Correct 159 ms 292 KB Output is correct
18 Correct 147 ms 208 KB Output is correct
19 Correct 151 ms 208 KB Output is correct
20 Correct 143 ms 208 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 208 KB Output is correct
23 Correct 1 ms 292 KB Output is correct
24 Correct 1 ms 208 KB Output is correct
25 Correct 2 ms 208 KB Output is correct
26 Correct 158 ms 208 KB Output is correct
27 Correct 0 ms 208 KB Output is correct
28 Correct 1 ms 208 KB Output is correct
29 Correct 1 ms 208 KB Output is correct
30 Correct 1 ms 208 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 149 ms 208 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 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 2 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 292 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 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 118 ms 292 KB Output is correct
17 Correct 159 ms 292 KB Output is correct
18 Correct 147 ms 208 KB Output is correct
19 Correct 151 ms 208 KB Output is correct
20 Correct 143 ms 208 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 208 KB Output is correct
23 Correct 1 ms 292 KB Output is correct
24 Correct 1 ms 208 KB Output is correct
25 Correct 2 ms 208 KB Output is correct
26 Correct 158 ms 208 KB Output is correct
27 Correct 0 ms 208 KB Output is correct
28 Correct 1 ms 208 KB Output is correct
29 Correct 1 ms 208 KB Output is correct
30 Correct 1 ms 208 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 149 ms 208 KB Output is correct
33 Incorrect 184 ms 300 KB Wrong Answer [6]
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 167 ms 288 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -