Submission #101261

# Submission time Handle Problem Language Result Execution time Memory
101261 2019-03-18T05:06:42 Z errorgorn ICC (CEOI16_icc) C++14
18 / 100
410 ms 680 KB
#include "icc.h"
#include <vector>
#include <cstdio>
using namespace std;
vector<int> v,u;
int p[105];
int pa(int i) {return (p[i]==i)? i:p[i]=pa(p[i]);}
void unions(int i,int j){
    i=pa(i);
    j=pa(j);
    p[i]=j;
}
void run(int n) {
    for (int x=1;x<=n;x++){
        p[x]=x;
    }
    u.push_back(0);
    int a,b;
    for (int _x=1;_x<n;_x++){
        a=-1,b=-1;
        while (b==-1){
            for (int x=1;x<=n;x++){
                u[0]=x;
                v.clear();
                for (int y=1;y<=n;y++){
                    if (pa(x)!=pa(y)) v.push_back(y);
                }
                int _u[]={u[0]};
                int _v[v.size()];
                for (int x=0;x<(int)v.size();x++) _v[x]=v[x];
                if(query(1,v.size(),_u,_v)==1){
                    if (a==-1) a=x;
                    else b=x;
                }
            }
        }
        //printf("%d %d\n",a,b);
        unions(a,b);
        setRoad(a,b);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 17 ms 512 KB Ok! 210 queries used.
2 Correct 14 ms 512 KB Ok! 210 queries used.
# Verdict Execution time Memory Grader output
1 Correct 156 ms 680 KB Ok! 2450 queries used.
2 Correct 156 ms 632 KB Ok! 2450 queries used.
3 Correct 162 ms 640 KB Ok! 2450 queries used.
# Verdict Execution time Memory Grader output
1 Incorrect 410 ms 552 KB Number of queries more than 4500 out of 2250
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 343 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 348 ms 568 KB Number of queries more than 3550 out of 1775
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 300 ms 640 KB Number of queries more than 3250 out of 1625
2 Halted 0 ms 0 KB -