Submission #35481

# Submission time Handle Problem Language Result Execution time Memory
35481 2017-11-22T14:19:09 Z imaxblue ICC (CEOI16_icc) C++14
0 / 100
6 ms 2088 KB
#include <bits/stdc++.h>
#include "icc.h"
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()

void setRoad(int a, int b);
int query(int x, int y, int a[], int b[]);
/*void setRoad(int x, int y){cout << "*" << x << ' ' << y << endl;}
bool query(int x, int y, vector<int> v, vector<int> w){
    fox(l, x) cout << v[l] << ' '; cout << endl;
    fox(l, y) cout << w[l] << ' '; cout << endl;
    int ans;
    cin >> ans;
    return ans;
};*/
int x, y, n, a[1005], b[1005];
vector<int> v, w, u;
bool query2(int x, int y, vector<int> v, vector<int> w){
    fox(l, x) a[l]=v[l];
    fox(l, y) b[l]=w[l];
    return query(x, y, a, b);
}
void solve(){
    int lo=0, mid, hi=v.size()-1;
    while(lo<hi){
        mid=(lo+hi)/2;
        u.clear();
        fox(l, mid+1) u.pb(v[l]);
        if (query2(mid+1, w.size(), u, w)){
            hi=mid;
        } else {
            lo=mid+1;
        }
    }
    x=v[lo];
    lo=0; hi=w.size()-1;
    while(lo<hi){
        mid=(lo+hi)/2;
        u.clear();
        fox(l, mid+1) u.pb(w[l]);
        if (query2(v.size(), mid+1, v, u)){
            hi=mid;
        } else {
            lo=mid+1;
        }
    }
    y=w[lo];
}
void get(){
    for (int b=1; ; b<<=1){
        v.clear();
        w.clear();
        fox1(l, n){
            if (b&l) v.pb(l);
            else w.pb(l);
        }
        if (query2(v.size(), w.size(), v, w)){
            solve();
            //cout << b << endl;
            return;
        }
    }
}
void run(int N){
    n=N;
    /*fox(l, N){
        v.pb(vector<int>(1, l+1));
    }*/
    fox(l, N-1){
        get();
        setRoad(x, y);
        /*fox(l, v[y].size()){
            v[x].pb(v[y][l]);
        }
        v.erase(v.begin()+y);*/
    }
}
/*int main(){
    run(4);
    return 0;
}*/
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2088 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2088 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2088 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2088 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2084 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 2088 KB Wrong road!
2 Halted 0 ms 0 KB -