제출 #108627

#제출 시각아이디문제언어결과실행 시간메모리
108627someone_aa도서관 (JOI18_library)C++17
0 / 100
3098 ms640 KiB
#include <cstdio> #include <vector> #include "library.h" #include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; const int maxn = 210; vector<int>adj[maxn]; void Solve(int N) { vector<int> M(N); for(int i=0;i<N;i++) { M[i] = 0; } for(int i=1;i<=N;i++) { for(int j=i+1;j<=N;j++) { M[i-1] = M[j-1] = 1; int x = Query(M); if(x == 1) { adj[i].pb(j); adj[j].pb(i); } M[i-1] = M[j-1] = 0; } } int st = 1; for(int i=1;i<=N;i++) { if(adj[i].size() == 1) { st = i; break; } } vector<int>v; v.pb(st); st = adj[st][0]; for(int i=0;i<N-1;i++) { if(adj[st][0] == v.back()) { v.pb(st); st = adj[st][1]; } else { v.pb(st); st = adj[st][0]; } } Answer(v); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...