답안 #501613

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
501613 2022-01-04T07:37:39 Z amunduzbaev Monster Game (JOI21_monster) C++17
10 / 100
218 ms 456 KB
#include "monster.h"
#include "bits/stdc++.h"
using namespace std;
#ifndef EVAL
#include "grader.cpp"
#endif

namespace {

bool example_variable;

}

vector<int> Solve(int n) {
	vector<int> in(n), out(n);
	vector<vector<bool>> qq(n, vector<bool>(n));
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			qq[i][j] = Query(i, j);
			qq[j][i] = !qq[i][j];
			if(qq[i][j]) in[i]++, out[j]++;
			else in[j]++, out[i]++;
		}
	}
	
	vector<int> p(n), res(n);
	for(int i=0;i<n;i++) p[i] = i;
	sort(p.begin(), p.end(), [&](int i, int j) -> bool{
		if(in[i] != in[j]) return (in[i] < in[j]);
		return qq[i][j];
	});
	
	int cur = 0;
	for(auto x : p){
		res[x] = cur++;
	} 
	
	//~ for(int i=0;i<n;i++) cout<<res[i]<<" ";
	//~ cout<<endl;
	return res;
}

/*

5
3 1 4 2 0

*/

Compilation message

monster.cpp:10:6: warning: '{anonymous}::example_variable' defined but not used [-Wunused-variable]
   10 | bool example_variable;
      |      ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 ms 280 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 0 ms 284 KB Output is correct
6 Correct 0 ms 200 KB Output is correct
7 Correct 0 ms 200 KB Output is correct
8 Correct 1 ms 200 KB Output is correct
9 Correct 1 ms 200 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Correct 1 ms 200 KB Output is correct
12 Correct 1 ms 200 KB Output is correct
13 Correct 1 ms 200 KB Output is correct
14 Correct 1 ms 200 KB Output is correct
15 Correct 0 ms 200 KB Output is correct
16 Correct 140 ms 200 KB Output is correct
17 Correct 167 ms 200 KB Output is correct
18 Correct 75 ms 200 KB Output is correct
19 Correct 164 ms 200 KB Output is correct
20 Correct 180 ms 200 KB Output is correct
21 Correct 1 ms 220 KB Output is correct
22 Correct 0 ms 200 KB Output is correct
23 Correct 1 ms 200 KB Output is correct
24 Correct 1 ms 200 KB Output is correct
25 Correct 1 ms 200 KB Output is correct
26 Correct 172 ms 200 KB Output is correct
27 Correct 0 ms 200 KB Output is correct
28 Correct 1 ms 200 KB Output is correct
29 Correct 0 ms 200 KB Output is correct
30 Correct 1 ms 200 KB Output is correct
31 Correct 1 ms 200 KB Output is correct
32 Correct 185 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 ms 280 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 0 ms 284 KB Output is correct
6 Correct 0 ms 200 KB Output is correct
7 Correct 0 ms 200 KB Output is correct
8 Correct 1 ms 200 KB Output is correct
9 Correct 1 ms 200 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Correct 1 ms 200 KB Output is correct
12 Correct 1 ms 200 KB Output is correct
13 Correct 1 ms 200 KB Output is correct
14 Correct 1 ms 200 KB Output is correct
15 Correct 0 ms 200 KB Output is correct
16 Correct 140 ms 200 KB Output is correct
17 Correct 167 ms 200 KB Output is correct
18 Correct 75 ms 200 KB Output is correct
19 Correct 164 ms 200 KB Output is correct
20 Correct 180 ms 200 KB Output is correct
21 Correct 1 ms 220 KB Output is correct
22 Correct 0 ms 200 KB Output is correct
23 Correct 1 ms 200 KB Output is correct
24 Correct 1 ms 200 KB Output is correct
25 Correct 1 ms 200 KB Output is correct
26 Correct 172 ms 200 KB Output is correct
27 Correct 0 ms 200 KB Output is correct
28 Correct 1 ms 200 KB Output is correct
29 Correct 0 ms 200 KB Output is correct
30 Correct 1 ms 200 KB Output is correct
31 Correct 1 ms 200 KB Output is correct
32 Correct 185 ms 200 KB Output is correct
33 Incorrect 218 ms 456 KB Wrong Answer [6]
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 90 ms 416 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -