답안 #130945

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
130945 2019-07-16T09:52:38 Z semiauto CEOI16_icc (CEOI16_icc) C++14
7 / 100
428 ms 636 KB
#include <bits/stdc++.h>
#include "icc.h"
using namespace std;
int i,j,k,q,sa,sb,l,r,m,x,alo,balo;
int parent[101],mas[101],a[101],b[101];
int fix[101],go[101][101];
int n;
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;
                srand(time(NULL));
        while (true) {q++;
            for (i=0;i<k;i++)
                fix[parent[i]]=rand()%2;
            sa=sb=0;
            for (i=0;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;
        }if (q>500)return;
        l=1;r=sa;
        while (l!=r) {
            m=(l+r)/2;
            for (i=0;i<=n;i++)
                mas[i]=0;
            for (i=l;i<=m;i++)
                mas[i-l]=a[i-1];
            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=0;i<=n;i++)
                mas[i]=0;
            for (i=l;i<=m;i++)
                mas[i-l]=b[i-1];
            if (query(sa,m-l+1,a,mas))
                r=m;
            else
                l=m+1;
        }
        int solo=parent[a[x-1]];
        for (i=1;i<=n;i++)
            if (parent[i]==solo)
                parent[i]=parent[b[l-1]];
        setRoad(b[l-1],a[x-1]);
        if (q>500)return;
    }
    return;
}

Compilation message

icc.cpp: In function 'void run(int)':
icc.cpp:18:13: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
             if (fix[i])
             ^~
icc.cpp:20:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
                 srand(time(NULL));
                 ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 504 KB Ok! 122 queries used.
2 Correct 9 ms 504 KB Ok! 114 queries used.
# 결과 실행 시간 메모리 Grader output
1 Incorrect 344 ms 564 KB Number of queries more than 5000 out of 2500
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 428 ms 552 KB Number of queries more than 4500 out of 2250
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 372 ms 632 KB Number of queries more than 4000 out of 2000
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 332 ms 504 KB Number of queries more than 3550 out of 1775
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 308 ms 636 KB Number of queries more than 3250 out of 1625
2 Halted 0 ms 0 KB -