Submission #1134202

#TimeUsernameProblemLanguageResultExecution timeMemory
1134202lopkusLibrary (JOI18_library)C++20
0 / 100
91 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 + 1].push_back(j + 1); s[j + 1].push_back(i + 1); } } } 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 + 1, 0); for(int i = 0; i < n; i++) { ans[i] = start; was[start] = 1; int next = - 1; for(auto it : s[start]) { if(was[it]) { continue; } next = it; break; } start = next; } Answer(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...