#include <bits/stdc++.h>
using namespace std;
typedef int ll;
const ll INF = 1e9+7;
const ll MOD = 998244353;
typedef pair<ll,ll> ii;
#define iii pair<ll,ii>
#define f(i,a,b) for(ll i = a;i < b;i++)
#define pb push_back
#define vll vector<ll>
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
///I hope I will get uprating and don't make mistakes
///I will never stop programming
///sqrt(-1) Love C++
///Please don't hack me
///@TheofanisOrfanou Theo830
///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst)
///Stay Calm
///Look for special cases
///Beware of overflow and array bounds
///Think the problem backwards
///CEOI 2016 day 1
#include "icc.h"
/*
int query(int size_a, int size_b, int a[], int b[]){
cout<<size_a<<" : ";
f(i,0,size_a){
cout<<a[i]<<" ";
}
cout<<"\n";
cout<<size_b<<" : ";
f(i,0,size_b){
cout<<b[i]<<" ";
}
cout<<"\n";
ll v;
cin>>v;
return v;
}
*/
vector<vll>adj;
ll posa = 0;
void run(int N){
ll n = N;
adj.assign(n+5,vll());
f(u,0,n-1){
ll a = -1,b;
f(i,1,n+1){
set<ll>ex;
f(j,1,n+1){
if(i != j){
ex.insert(j);
}
}
for(auto x:adj[i]){
ex.erase(x);
}
ll A[1] = {i};
ll sb = ex.size();
ll B[sb];
ll pos = 0;
for(auto x:ex){
B[pos] = x;
pos++;
}
posa++;
assert(posa <= 1500);
if(query(1,sb,A,B)){
if(a == -1){
a = i;
}
else{
b = i;
break;
}
}
}
//cout<<a<<" "<<b<<"\n";
setRoad(a,b);
adj[a].pb(b);
adj[b].pb(a);
}
}
/*
int main(){
run(4);
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
468 KB |
Ok! 210 queries used. |
2 |
Incorrect |
5 ms |
468 KB |
Wrong road! |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
14 ms |
492 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
123 ms |
732 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
47 ms |
468 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
40 ms |
484 KB |
Wrong road! |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
126 ms |
752 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |