답안 #139469

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
139469 2019-07-31T19:56:18 Z zoooma13 도서관 (JOI18_library) C++14
19 / 100
343 ms 504 KB
#include "bits/stdc++.h"
#include "library.h"
using namespace std;

#define MAX_N 202

void Solve(int N)
{
    assert(N < MAX_N);

    if(N == 1){
        Answer({1});
        return;
    }

	vector <int> M(N);
    vector <vector<int>> adj(N);
	for(int i=0; i<N; i++){
        M[i] = 1;
		for(int j=i+1; j<N; j++){
            M[j] = 1;
            if(Query(M) == 1)
                adj[i].push_back(j),
                adj[j].push_back(i);
            M[j] = 0;
		}
		M[i] = 0;
	}

	int st;
    for(int i=0; i<N; i++)
        if(adj[i].size() == 1)
            st = i;

    vector <int> res;
    for(int i=0; i<N; i++){
        res.push_back(st+1);
        int to = adj[st].front();
        adj[to].erase(find(adj[to].begin() ,adj[to].end() ,st));
        st = to;
    }

	Answer(res);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 328 ms 248 KB # of queries: 18336
2 Correct 296 ms 448 KB # of queries: 18145
3 Correct 308 ms 324 KB # of queries: 19900
4 Correct 343 ms 376 KB # of queries: 19900
5 Correct 317 ms 376 KB # of queries: 19900
6 Correct 320 ms 316 KB # of queries: 19900
7 Correct 323 ms 448 KB # of queries: 19900
8 Correct 229 ms 376 KB # of queries: 18528
9 Correct 314 ms 404 KB # of queries: 19701
10 Correct 132 ms 376 KB # of queries: 8256
11 Correct 2 ms 248 KB # of queries: 0
12 Correct 2 ms 376 KB # of queries: 1
13 Correct 2 ms 248 KB # of queries: 3
14 Correct 2 ms 248 KB # of queries: 6
15 Correct 3 ms 376 KB # of queries: 105
16 Correct 5 ms 316 KB # of queries: 351
# 결과 실행 시간 메모리 Grader output
1 Correct 328 ms 248 KB # of queries: 18336
2 Correct 296 ms 448 KB # of queries: 18145
3 Correct 308 ms 324 KB # of queries: 19900
4 Correct 343 ms 376 KB # of queries: 19900
5 Correct 317 ms 376 KB # of queries: 19900
6 Correct 320 ms 316 KB # of queries: 19900
7 Correct 323 ms 448 KB # of queries: 19900
8 Correct 229 ms 376 KB # of queries: 18528
9 Correct 314 ms 404 KB # of queries: 19701
10 Correct 132 ms 376 KB # of queries: 8256
11 Correct 2 ms 248 KB # of queries: 0
12 Correct 2 ms 376 KB # of queries: 1
13 Correct 2 ms 248 KB # of queries: 3
14 Correct 2 ms 248 KB # of queries: 6
15 Correct 3 ms 376 KB # of queries: 105
16 Correct 5 ms 316 KB # of queries: 351
17 Runtime error 3 ms 424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 2 ms 424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 2 ms 380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)