Submission #223449

# Submission time Handle Problem Language Result Execution time Memory
223449 2020-04-15T09:26:18 Z MKopchev ICC (CEOI16_icc) C++14
7 / 100
518 ms 632 KB
#include <bits/stdc++.h>
#include "icc.h"
using namespace std;

const int nmax=100+42;
/*
void setRoad(int a,int b)
{
    cout<<"set "<<a<<" "<<b<<endl;
}

int query(int size_a,int size_b,int a[],int b[])
{
    cout<<"size_a "<<size_a<<" a ";for(int i=0;i<size_a;i++)cout<<a[i]<<" ";cout<<endl;

    cout<<"size_b "<<size_b<<" b ";for(int i=0;i<size_b;i++)cout<<b[i]<<" ";cout<<endl;

    int ret;
    cin>>ret;
    return ret;
}
*/
int size_a,size_b,a[nmax],b[nmax];

int n;

int parent[nmax];

int root(int node)
{
    if(node==parent[node])return parent[node];
    parent[node]=root(parent[node]);
    return parent[node];
}

int my_ask(vector<int> lhs,vector<int> rhs)
{
    size_a=lhs.size();
    for(int i=0;i<size_a;i++)
        a[i]=lhs[i];

    size_b=rhs.size();
    for(int i=0;i<size_b;i++)
        b[i]=rhs[i];

    return query(size_a,size_b,a,b);
}

void run(int N)
{
    n=N;
    for(int i=1;i<=n;i++)parent[i]=i;

    for(int i=1;i<n;i++)
    {
        for(int u=1;u<=n;u++)
            for(int v=u+1;v<=n;v++)
                if(root(u)!=root(v))
                {
                    if(my_ask({u},{v}))
                    {
                        setRoad(u,v);
                        parent[root(u)]=root(v);
                        u=n;
                        v=n;
                    }
                }
    }
}
/*
int main()
{
    run(4);
}
*/
# Verdict Execution time Memory Grader output
1 Correct 72 ms 512 KB Ok! 1015 queries used.
2 Correct 75 ms 512 KB Ok! 1010 queries used.
# Verdict Execution time Memory Grader output
1 Incorrect 411 ms 632 KB Number of queries more than 5000 out of 2500
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 518 ms 512 KB Number of queries more than 4500 out of 2250
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 460 ms 512 KB Number of queries more than 4000 out of 2000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 423 ms 632 KB Number of queries more than 3550 out of 1775
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 391 ms 512 KB Number of queries more than 3250 out of 1625
2 Halted 0 ms 0 KB -