#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[r];
}
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;
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
155 ms |
468 KB |
Number of queries more than 3000 out of 1500 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
271 ms |
468 KB |
Number of queries more than 5000 out of 2500 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
281 ms |
476 KB |
Number of queries more than 4500 out of 2250 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
251 ms |
468 KB |
Number of queries more than 4000 out of 2000 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
263 ms |
464 KB |
Number of queries more than 3550 out of 1775 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
204 ms |
460 KB |
Number of queries more than 3250 out of 1625 |
2 |
Halted |
0 ms |
0 KB |
- |