제출 #285391

#제출 시각아이디문제언어결과실행 시간메모리
285391peti1234Highway Tolls (IOI18_highway)C++17
0 / 100
31 ms760 KiB
#include <bits/stdc++.h> #include "highway.h" using namespace std; const int c=90002; long long m, dist, xo, s, kul, ert[c], cnt, ki, cs1, cs2;; bool v[c]; vector<int> sz; /* int ask(vector<int> sz) { for (int i=0; i<m; i++) cout << sz[i] << " "; int x; cin >> x; return x; } void answer(int a, int b) { cout << "valasz " << a << " " << b << "\n"; }*/ void find_pair(int n, vector<int> x, vector<int> y, int gy, int e) { m=x.size(), sz.resize(m); for (int i=0; i<m; i++) sz[i]=1; dist=ask(sz); for (int i=0; i<18; i++) { for (int j=0; j<m; j++) { if (((x[j])&(1<<i))==(((y[j])&(1<<i)))) sz[j]=0; else sz[j]=1; } s=ask(sz); kul=(dist-s)/(e-gy); if (kul%2) xo+=(1<<i); } for (int i=0; i<n; i++) { int f=(i^xo); if (!v[i] && f<n && !v[f]) v[i]=1, v[f]=1, cnt++, ert[i]=cnt; } /*cout << "ertekek "; for (int i=0; i<n; i++) cout << ert[i] << " "; cout << "\n";*/ for (int i=0; i<18; i++) { for (int j=0; j<m; j++) { if ((ert[x[j]]&(1<<i))==(ert[y[j]]&(1<<i))) sz[j]=0; else sz[j]=1; } s=ask(sz); kul=(dist-s)/(e-gy); if (kul%2) ki+=(1<<i); } for (int i=0; i<n; i++) if (ert[i]==ki) cs1=i; cs2=(cs1^xo); answer(cs1, cs2); }
#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...