Submission #98183

# Submission time Handle Problem Language Result Execution time Memory
98183 2019-02-21T08:25:32 Z onjo0127 Library (JOI18_library) C++11
0 / 100
2000 ms 576 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 255 ms 256 KB # of queries: 18336
2 Correct 271 ms 380 KB # of queries: 18145
3 Correct 351 ms 408 KB # of queries: 19900
4 Correct 295 ms 404 KB # of queries: 19900
5 Correct 321 ms 256 KB # of queries: 19900
6 Correct 297 ms 320 KB # of queries: 19900
7 Correct 279 ms 384 KB # of queries: 19900
8 Correct 301 ms 384 KB # of queries: 18528
9 Correct 267 ms 448 KB # of queries: 19701
10 Correct 112 ms 376 KB # of queries: 8256
11 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 2 ms 256 KB # of queries: 1
13 Correct 2 ms 284 KB # of queries: 3
14 Correct 3 ms 256 KB # of queries: 6
15 Correct 3 ms 384 KB # of queries: 105
16 Correct 9 ms 384 KB # of queries: 351
# Verdict Execution time Memory Grader output
1 Correct 255 ms 256 KB # of queries: 18336
2 Correct 271 ms 380 KB # of queries: 18145
3 Correct 351 ms 408 KB # of queries: 19900
4 Correct 295 ms 404 KB # of queries: 19900
5 Correct 321 ms 256 KB # of queries: 19900
6 Correct 297 ms 320 KB # of queries: 19900
7 Correct 279 ms 384 KB # of queries: 19900
8 Correct 301 ms 384 KB # of queries: 18528
9 Correct 267 ms 448 KB # of queries: 19701
10 Correct 112 ms 376 KB # of queries: 8256
11 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Correct 2 ms 256 KB # of queries: 1
13 Correct 2 ms 284 KB # of queries: 3
14 Correct 3 ms 256 KB # of queries: 6
15 Correct 3 ms 384 KB # of queries: 105
16 Correct 9 ms 384 KB # of queries: 351
17 Runtime error 18 ms 456 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 160 ms 552 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 27 ms 456 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 21 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 18 ms 380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 13 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 22 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 28 ms 424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 80 ms 536 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 21 ms 576 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 31 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Execution timed out 3062 ms 256 KB Time limit exceeded
29 Execution timed out 3086 ms 384 KB Time limit exceeded
30 Execution timed out 3092 ms 256 KB Time limit exceeded