Submission #203442

#TimeUsernameProblemLanguageResultExecution timeMemory
203442kostia244ICC (CEOI16_icc)C++17
0 / 100
329 ms1016 KiB
#ifndef kostia #include"icc.h" #endif #include<bits/stdc++.h> #define pb push_back #define all(x) x.begin(), x.end() using namespace std; using ll = long long; using vi = vector<ll>; using pi = pair<int, int>; using vpi = vector<pi>; #ifdef kostia vpi local_roads; int local_cur = 0, local_n; int query(int sa, int sb, int a[], int b[]) { cout << sa << " " << sb << " :: "; for(int i = 0; i < sa; i++) cout << a[i] << " "; cout << " - "; for(int i = 0; i < sb; i++) cout << b[i] << " "; cout << "\n"; for(int i = 0; i < sa; i++) { for(int j = 0; j < sb; j++) { for(auto k : local_roads) { if(a[i]==k.first && b[j]==k.second) return 1; if(a[i]==k.second && b[j]==k.first) return 1; } } } return 0; } void setRoad(int a, int b) { if(pi{a, b}!=local_roads.back()&&pi{b, a}!=local_roads.back()) { cout << a << " " << b << "\n"; cout << "BAD"; exit(0); } cout << "road " << local_roads.back().first << " " << local_roads.back().second << " guessed.\n"; if(++local_cur==local_n) exit(0); cin >> a >> b; local_roads.pb({a, b}); } #endif const int maxn = 1e2 + 21; int n; int a[maxn], b[maxn]; int q(vi x, vi y) { if(x.empty()||y.empty()) return 0; for(int i = 0; i < x.size(); i++) a[i] = x[i]; for(int i = 0; i < y.size(); i++) b[i] = y[i]; return query(x.size(), y.size(), a, b); } vi unc[maxn]; void erase(vi& a, int x) { for(int i = 0; i < a.size(); i++) { if(a[i]==x) { swap(a[i], a.back()); a.pop_back(); return; } } cout << "BADd"; exit(-1); } void run(int _n) { n = _n; for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) if(i!=j) unc[i].pb(j); for(int edge = 1; edge < n; edge++) { int x = -1, y = -1; for(int i = 1; y == -1 && i <= n; i++) { if(q(vi{i}, unc[i])) { if(x==-1) x = i; else y = i; } } assert(q(vi{x}, vi{y})); setRoad(x, y); erase(unc[x], y); erase(unc[y], x); } } #ifdef kostia int main() { ios::sync_with_stdio(0); cin.tie(0); cout << "kostia:\n"; int x, y; cin >> local_n >> x >> y; local_roads.pb({x, y}); local_cur = 1; run(local_n); return 0; } #endif

Compilation message (stderr)

icc.cpp: In function 'int q(vi, vi)':
icc.cpp:48:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < x.size(); i++) a[i] = x[i];
                 ~~^~~~~~~~~~
icc.cpp:49:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < y.size(); i++) b[i] = y[i];
                 ~~^~~~~~~~~~
icc.cpp: In function 'void erase(vi&, int)':
icc.cpp:54:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < a.size(); i++) {
                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...