제출 #1132394

#제출 시각아이디문제언어결과실행 시간메모리
1132394ByeWorldLibrary (JOI18_library)C++20
19 / 100
133 ms448 KiB
#include <bits/stdc++.h> #include "library.h" #define ll long long #define pb push_back #define fi first #define se second #define lf (id<<1) #define rg ((id<<1)|1) #define md ((l+r)>>1) #define ld long double using namespace std; typedef pair<int,int> pii; typedef pair<char,char> pcc; typedef pair<int,pii> ipii; typedef pair<pii,pii> ipiii; const int MAXN = 2e5+10; const int SQRT = 610; const int MAXA = 50; const int MOD = 998244353; const int INF = 1e9+10; const int LOG = 21; const ld EPS = 1e-12; vector <int> que, adj[1010], ans; int n; void QUE(int x, int y){ for(int i=0; i<n; i++) que[i] = 0; que[x] = que[y] = 1; } void dfs(int nw, int par){ ans.pb(nw+1); for(auto nx : adj[nw]){ if(nx==par) continue; dfs(nx, nw); } } void Solve(int N) { n = N; que.resize(n); for(int i=0; i<n; i++){ for(int j=i+1; j<n; j++){ QUE(i, j); int ret = Query(que); if(ret==1){ adj[i].pb(j); adj[j].pb(i); // cout << i << ' '<< j << " pp\n"; } } } int sta = 0; for(int i=0; i<n; i++) if(adj[i].size() == 1) sta = i; dfs(sta, -1); // for(auto in : ans) cout << in << " in\n"; Answer(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...