# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
465480 | 2021-08-16T08:15:23 Z | BT21tata | CEOI16_icc (CEOI16_icc) | C++17 | 0 ms | 0 KB |
#include<bits/stdc++.h> #include "icc.h" // #pragma GCC target ("avx,avx2,fma") // #pragma GCC optimize("Ofast") // #pragma GCC optimize("unroll-loops") typedef long long ll; typedef long double ld; #define SPEED ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0) #define rall(v) (v).rbegin(),(v).rend() #define all(v) (v).begin(),(v).end() #define OK cerr<<"OK"<<endl<<flush #define pii pair<int, int> #define pll pair<ll, ll> #define pb push_back #define F first #define S second #define y0 jahdakdh #define y1 jahsadakdakdh #define endl '\n' const ll MOD=1e9+7; using namespace std; //mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count()); bool e[105][105]; int bs(int x, int n) { vector<int>v; for(int i=x+1; i<=n; i++) if(!e[x][i]) v.pb(i); int l=0, r=v.size()-1, mid; while(l<r) { mid=(l+r)>>1; int b[n], pos=0; for(int i=l; i<=mid; i++) b[pos++]=v[i]; bool f=query(1, mid-l+1, {x}, b); if(f) r=mid; else l=mid+1; } return v[l]; } void run(int n) { for(int cnt=1; cnt<n; cnt++) { for(int i=1; i<=n; i++) { int numb=0, b[n]; for(int j=i+1; j<=n; j++) if(!e[i][j]) b[numb++]=j; if(!numb) continue; bool f=query(1, numb, {i}, b); if(f) { int x=bs(i, n); setRoad(i, x); e[i][x]=e[x][i]=1; } } } }