Submission #549665

# Submission time Handle Problem Language Result Execution time Memory
549665 2022-04-16T08:42:16 Z AJ00 Library (JOI18_library) C++14
0 / 100
276 ms 436 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);
    }
    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 211 ms 316 KB # of queries: 18336
2 Correct 228 ms 308 KB # of queries: 18145
3 Correct 223 ms 308 KB # of queries: 19900
4 Correct 248 ms 312 KB # of queries: 19900
5 Correct 272 ms 312 KB # of queries: 19900
6 Correct 276 ms 312 KB # of queries: 19900
7 Correct 276 ms 436 KB # of queries: 19900
8 Correct 228 ms 312 KB # of queries: 18528
9 Correct 255 ms 312 KB # of queries: 19701
10 Correct 128 ms 312 KB # of queries: 8256
11 Incorrect 0 ms 208 KB Wrong Answer [7]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 211 ms 316 KB # of queries: 18336
2 Correct 228 ms 308 KB # of queries: 18145
3 Correct 223 ms 308 KB # of queries: 19900
4 Correct 248 ms 312 KB # of queries: 19900
5 Correct 272 ms 312 KB # of queries: 19900
6 Correct 276 ms 312 KB # of queries: 19900
7 Correct 276 ms 436 KB # of queries: 19900
8 Correct 228 ms 312 KB # of queries: 18528
9 Correct 255 ms 312 KB # of queries: 19701
10 Correct 128 ms 312 KB # of queries: 8256
11 Incorrect 0 ms 208 KB Wrong Answer [7]
12 Halted 0 ms 0 KB -