Submission #130735

# Submission time Handle Problem Language Result Execution time Memory
130735 2019-07-16T04:25:13 Z semiauto ICC (CEOI16_icc) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
#include "icc.h"
using namespace std;
int i,j,k,sa,sb,l,r,m,x;
int parent[101],mas[101],a[101],b[101];
bool fix[101];
void run(int n) {
    for (i=1;i<=n;i++)
        parent[i]=i;
    for (j=1;j<n;j++) {
        for (i=1;i<=n;i++)
            fix[i]=0;
        for (i=1;i<=n;i++)
            fix[parent[i]]=1;
        k=0;
        for (i=1;i<=n;i++)
            if (fix[i])
                mas[++k]=i;
        sa=sb=a[1]=1;b[1]=2;
        i=query(sa,sb,a,b);return;
        while (true) {
            for (i=1;i<=n;i++)
                fix[i]=0;
            for (i=1;i<=(k/2);)
                if (!fix[mas[(rand()%k)+1]]) {
                    fix[mas[(rand()%k)+1]]=1;
                    i++;
                }
            sa=sb=0;
            for (i=1;i<=n;i++)
                a[i]=b[i]=0;
            for (i=1;i<=n;i++) {
                if (fix[parent[i]])
                    a[++sa]=i;
                else
                    b[++sb]=i;
            }
            if (query(sa,sb,a,b))
                break;
        }
        return;
        l=1;r=sa;
        while (l!=r) {
            m=(l+r)/2;
            for (i=1;i<=n;i++)
                mas[i]=0;
            for (i=l;i<=m;i++)
                mas[i-l+1]=a[i];
            if (query(m-l+1,sb,mas,b))
                r=m;
            else
                l=m+1;
        }
        x=l;
        l=1;r=sb;
        while (l!=r) {
            m=(l+r)/2;
            for (i=1;i<=n;i++)
                mas[i]=0;
            for (i=l;i<=m;i++)
                mas[i-l+1]=b[i];
            if (query(sa,m-l+1,a,mas))
                r=m;
            else
                l=m+1;
        }
        for (i=1;i<=n;i++)
            if (parent[i]==parent[a[x]])
                parent[i]=parent[b[l]];
        setRoad(a[x],b[l]);
    }
    return;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Query cities not in range [1, n]
2 Halted 0 ms 0 KB -