Submission #1134198

#TimeUsernameProblemLanguageResultExecution timeMemory
1134198lopkusLibrary (JOI18_library)C++20
Compilation error
0 ms0 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); }

Compilation message (stderr)

library.cpp: In function 'void Solve(int)':
library.cpp:14:21: error: 'query' was not declared in this scope; did you mean 'Query'?
   14 |             int u = query(ask);
      |                     ^~~~~
      |                     Query