Submission #98184

# Submission time Handle Problem Language Result Execution time Memory
98184 2019-02-21T08:26:55 Z onjo0127 Library (JOI18_library) C++11
19 / 100
2000 ms 632 KB
#include <cstdio>
#include <vector>
#include "library.h"
using namespace std;

vector<int> adj[209];

void Solve(int N) {
	vector<int> M(N, 0);
	for(int i=0; i<N; i++) {
        M[i] = 1;
        for(int j=i+1; j<N; j++) {
            M[j] = 1;
            int x = Query(M);
            if(x == 1) {
                adj[i].push_back(j);
                adj[j].push_back(i);
            }
            M[j] = 0;
        }
        M[i] = 0;
	}
	vector<int> ans;
	int st, p;
	for(int i=0; i<N; i++) if(adj[i].size() <= 1) st = p = i;
	while(1) {
        ans.push_back(st + 1);
        for(auto& it: adj[st]) if(it != p) {
            p = st;
            st = it;
            break;
        }
        if(ans.back() == st + 1) break;
	}
	Answer(ans);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:28:32: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
         for(auto& it: adj[st]) if(it != p) {
                                ^~
library.cpp:27:26: warning: 'st' may be used uninitialized in this function [-Wmaybe-uninitialized]
         ans.push_back(st + 1);
                       ~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 226 ms 444 KB # of queries: 18336
2 Correct 264 ms 384 KB # of queries: 18145
3 Correct 246 ms 328 KB # of queries: 19900
4 Correct 366 ms 320 KB # of queries: 19900
5 Correct 302 ms 384 KB # of queries: 19900
6 Correct 293 ms 256 KB # of queries: 19900
7 Correct 345 ms 376 KB # of queries: 19900
8 Correct 307 ms 384 KB # of queries: 18528
9 Correct 309 ms 424 KB # of queries: 19701
10 Correct 113 ms 512 KB # of queries: 8256
11 Correct 2 ms 384 KB # of queries: 0
12 Correct 2 ms 384 KB # of queries: 1
13 Correct 2 ms 384 KB # of queries: 3
14 Correct 2 ms 256 KB # of queries: 6
15 Correct 3 ms 320 KB # of queries: 105
16 Correct 6 ms 256 KB # of queries: 351
# Verdict Execution time Memory Grader output
1 Correct 226 ms 444 KB # of queries: 18336
2 Correct 264 ms 384 KB # of queries: 18145
3 Correct 246 ms 328 KB # of queries: 19900
4 Correct 366 ms 320 KB # of queries: 19900
5 Correct 302 ms 384 KB # of queries: 19900
6 Correct 293 ms 256 KB # of queries: 19900
7 Correct 345 ms 376 KB # of queries: 19900
8 Correct 307 ms 384 KB # of queries: 18528
9 Correct 309 ms 424 KB # of queries: 19701
10 Correct 113 ms 512 KB # of queries: 8256
11 Correct 2 ms 384 KB # of queries: 0
12 Correct 2 ms 384 KB # of queries: 1
13 Correct 2 ms 384 KB # of queries: 3
14 Correct 2 ms 256 KB # of queries: 6
15 Correct 3 ms 320 KB # of queries: 105
16 Correct 6 ms 256 KB # of queries: 351
17 Runtime error 16 ms 552 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 152 ms 448 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 37 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 19 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 14 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 14 ms 424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 16 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 25 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 93 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 17 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 28 ms 548 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Execution timed out 3020 ms 256 KB Time limit exceeded
29 Execution timed out 3062 ms 256 KB Time limit exceeded
30 Execution timed out 3041 ms 256 KB Time limit exceeded