Submission #549662

# Submission time Handle Problem Language Result Execution time Memory
549662 2022-04-16T08:38:25 Z AJ00 Library (JOI18_library) C++14
0 / 100
264 ms 440 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);
    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 244 ms 308 KB # of queries: 18336
2 Correct 218 ms 428 KB # of queries: 18145
3 Correct 256 ms 432 KB # of queries: 19900
4 Correct 233 ms 440 KB # of queries: 19900
5 Correct 248 ms 300 KB # of queries: 19900
6 Correct 264 ms 308 KB # of queries: 19900
7 Correct 264 ms 312 KB # of queries: 19900
8 Correct 208 ms 324 KB # of queries: 18528
9 Correct 227 ms 328 KB # of queries: 19701
10 Correct 98 ms 208 KB # of queries: 8256
11 Incorrect 0 ms 208 KB Wrong Answer [4]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 244 ms 308 KB # of queries: 18336
2 Correct 218 ms 428 KB # of queries: 18145
3 Correct 256 ms 432 KB # of queries: 19900
4 Correct 233 ms 440 KB # of queries: 19900
5 Correct 248 ms 300 KB # of queries: 19900
6 Correct 264 ms 308 KB # of queries: 19900
7 Correct 264 ms 312 KB # of queries: 19900
8 Correct 208 ms 324 KB # of queries: 18528
9 Correct 227 ms 328 KB # of queries: 19701
10 Correct 98 ms 208 KB # of queries: 8256
11 Incorrect 0 ms 208 KB Wrong Answer [4]
12 Halted 0 ms 0 KB -