제출 #1134199

#제출 시각아이디문제언어결과실행 시간메모리
1134199lopkus도서관 (JOI18_library)C++20
0 / 100
92 ms632 KiB
#include <bits/stdc++.h> #include "library.h" using namespace std; void Solve(int n){ vector<int> s[n + 1]; for(int i = 0; i < n; i++) { for(int j = i + 1; j < n; j++) { vector<int> ask(n, 0); ask[i] = 1; ask[j] = 1; int u = Query(ask); if(u) { s[i].push_back(j); s[j].push_back(i); } } } int start = - 1; for(int i = 0 ; i < n; i++) { if(s[i].size() == 1) { start = i; } } vector<int> ans(n); int idx = 0; vector<int> was(n, 0); while(idx < n) { ans[idx++] = start + 1; was[start] = 1; for(auto it : s[start]) { if(was[it]) { continue; } start = it; } } Answer(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...