Submission #604623

# Submission time Handle Problem Language Result Execution time Memory
604623 2022-07-25T08:15:37 Z Theo830 ICC (CEOI16_icc) C++17
0 / 100
133 ms 736 KB
#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());
    while(1){
        ll a = -1,b = -1;
        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(sb != 0);
            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);
}
*/
# Verdict Execution time Memory Grader output
1 Correct 12 ms 468 KB Ok! 210 queries used.
2 Incorrect 9 ms 468 KB Wrong road!
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 468 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 122 ms 736 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 484 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 480 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 133 ms 732 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -