답안 #48067

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
48067 2018-05-10T02:10:55 Z kawaiigrabrielneko 도서관 (JOI18_library) C++14
19 / 100
2000 ms 716 KB
#include <cstdio>
#include <vector>
#include "library.h"
using namespace std;

vector<int> al[209];

void Solve(int N){
	vector<int> M(N);
	for (int i = 0; i < N; i++){
        for (int j = 0; j < i; j++){
            M[i] = 1;
            M[j] = 1;
            if (Query(M)==1){
                al[i].push_back(j);
                al[j].push_back(i);
            }
            M[i] = 0;
            M[j] = 0;
        }
	}
	int ed = 0;
	while (al[ed].size()==2) ed++;
	vector<int> ans(N);
	ans[0] = ed;
	if (N>1) ans[1] = al[ed][0];
	for (int i = 2; i < N; i++){
        if (al[ans[i-1]][0]==ans[i-2]) ans[i] = al[ans[i-1]][1];
        else ans[i] = al[ans[i-1]][0];
	}
	for (int i = 0; i < N; i++){
        ans[i]++;
	}
	Answer(ans);
}

# 결과 실행 시간 메모리 Grader output
1 Correct 244 ms 312 KB Output is correct
2 Correct 280 ms 436 KB Output is correct
3 Correct 309 ms 436 KB Output is correct
4 Correct 296 ms 576 KB Output is correct
5 Correct 267 ms 580 KB Output is correct
6 Correct 295 ms 580 KB Output is correct
7 Correct 333 ms 612 KB Output is correct
8 Correct 265 ms 612 KB Output is correct
9 Correct 285 ms 664 KB Output is correct
10 Correct 122 ms 664 KB Output is correct
11 Correct 2 ms 664 KB Output is correct
12 Correct 2 ms 664 KB Output is correct
13 Correct 2 ms 664 KB Output is correct
14 Correct 2 ms 664 KB Output is correct
15 Correct 3 ms 664 KB Output is correct
16 Correct 5 ms 664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 244 ms 312 KB Output is correct
2 Correct 280 ms 436 KB Output is correct
3 Correct 309 ms 436 KB Output is correct
4 Correct 296 ms 576 KB Output is correct
5 Correct 267 ms 580 KB Output is correct
6 Correct 295 ms 580 KB Output is correct
7 Correct 333 ms 612 KB Output is correct
8 Correct 265 ms 612 KB Output is correct
9 Correct 285 ms 664 KB Output is correct
10 Correct 122 ms 664 KB Output is correct
11 Correct 2 ms 664 KB Output is correct
12 Correct 2 ms 664 KB Output is correct
13 Correct 2 ms 664 KB Output is correct
14 Correct 2 ms 664 KB Output is correct
15 Correct 3 ms 664 KB Output is correct
16 Correct 5 ms 664 KB Output is correct
17 Execution timed out 2064 ms 716 KB Time limit exceeded
18 Halted 0 ms 0 KB -