Submission #549667

# Submission time Handle Problem Language Result Execution time Memory
549667 2022-04-16T08:43:35 Z AJ00 Library (JOI18_library) C++14
19 / 100
429 ms 444 KB
#include <bits/stdc++.h>
#include "library.h"
using namespace std;
int n;
vector<int> res;
vector<vector<int>> adj(1001);
void dfs(int x, int p = 0){
    res.push_back(x);
    for (int ch: adj[x]){
        if (ch != p){
            dfs(ch,x);
        }
    }
}
void Solve(int N){
    n = N;
    vector<int> M(n);
    if (n == 1){
        res.push_back(1);
        Answer(res);
        return;
    }
    for (int i = 1; i <= n; i++){
        for (int j = i+1; j <= n; j++){
            fill(M.begin(),M.end(),0);
            M[i-1] = 1;
            M[j-1] = 1;
            int ans = Query(M);
            if (ans == 1){
                adj[i].push_back(j);
                adj[j].push_back(i);
            }
        }
    }
    for (int i = 1; i <= n; i++){
        if (adj[i].size() == 1){
            dfs(i);
            break;
        }
    }
    Answer(res);
}
# Verdict Execution time Memory Grader output
1 Correct 227 ms 308 KB # of queries: 18336
2 Correct 209 ms 316 KB # of queries: 18145
3 Correct 258 ms 312 KB # of queries: 19900
4 Correct 242 ms 312 KB # of queries: 19900
5 Correct 268 ms 444 KB # of queries: 19900
6 Correct 226 ms 432 KB # of queries: 19900
7 Correct 257 ms 208 KB # of queries: 19900
8 Correct 244 ms 308 KB # of queries: 18528
9 Correct 233 ms 436 KB # of queries: 19701
10 Correct 124 ms 208 KB # of queries: 8256
11 Correct 0 ms 208 KB # of queries: 0
12 Correct 1 ms 208 KB # of queries: 1
13 Correct 0 ms 208 KB # of queries: 3
14 Correct 0 ms 208 KB # of queries: 6
15 Correct 2 ms 208 KB # of queries: 105
16 Correct 5 ms 208 KB # of queries: 351
# Verdict Execution time Memory Grader output
1 Correct 227 ms 308 KB # of queries: 18336
2 Correct 209 ms 316 KB # of queries: 18145
3 Correct 258 ms 312 KB # of queries: 19900
4 Correct 242 ms 312 KB # of queries: 19900
5 Correct 268 ms 444 KB # of queries: 19900
6 Correct 226 ms 432 KB # of queries: 19900
7 Correct 257 ms 208 KB # of queries: 19900
8 Correct 244 ms 308 KB # of queries: 18528
9 Correct 233 ms 436 KB # of queries: 19701
10 Correct 124 ms 208 KB # of queries: 8256
11 Correct 0 ms 208 KB # of queries: 0
12 Correct 1 ms 208 KB # of queries: 1
13 Correct 0 ms 208 KB # of queries: 3
14 Correct 0 ms 208 KB # of queries: 6
15 Correct 2 ms 208 KB # of queries: 105
16 Correct 5 ms 208 KB # of queries: 351
17 Runtime error 429 ms 308 KB Execution killed with signal 13
18 Halted 0 ms 0 KB -