Submission #994842

# Submission time Handle Problem Language Result Execution time Memory
994842 2024-06-08T07:24:16 Z Aiperiii Library (JOI18_library) C++14
0 / 100
77 ms 344 KB
#include <bits/stdc++.h>
#include "library.h"
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
void Solve(int N){
    vector <int> g[N+1];
    vector <int> x(N),res(N),used(N+1);
    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
            if(i!=j && g[i].size()<2 && g[j].size()<2){
                x[i-1]=1;x[j-1]=1;
                if(g[i].size()==0 or g[i][0]!=j){
                    if(Query(x)==1){
                        g[i].pb(j);
                        g[j].pb(i);
                    }
                }
                x[i-1]=0;x[j-1]=0;
            }
        }
    }
    int st=0,cnt=1;
    for(int i=1;i<=N;i++){
        if(g[i].size()==1)st=i;
    }
    res[st-1]=cnt;
    used[st]=1;
    while(cnt<N){
        for(auto x : g[st]){
            if(!used[x]){
                cnt++;
                res[x-1]=cnt;
                used[x]=1;
                st=x;
            }
        }
    }
    Answer(res);
}



# Verdict Execution time Memory Grader output
1 Incorrect 77 ms 344 KB Wrong Answer [8]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 77 ms 344 KB Wrong Answer [8]
2 Halted 0 ms 0 KB -