답안 #130937

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
130937 2019-07-16T09:40:47 Z semiauto CEOI16_icc (CEOI16_icc) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "icc.h>
using namespace std;
int i,j,k,sa,sb,l,r,m,x,alo,balo;
int parent[101],mas[101],a[101],b[101];
bool fix[101],go[101][101];
int n;/*
bool query(int a,int b,int *A,int *B) {
    int i,j;
    for (i=0;i<a;i++)
        for (j=0;j<b;j++)
            if (go[A[i]][B[j]])
                return true;
    return false;
}
void setRoad(int a,int b) {
    cout<<a<<" "<<b<<endl;
    cin>>alo>>balo;
    go[alo][balo]=go[balo][alo]=1;
}*/
void run(int n) {
    srand(time(NULL));
    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;
        while (true) {
            for (i=0;i<=n;i++)
                fix[i]=0;
            for (i=1;i<=(k/2);)
                if (!fix[mas[(rand()%k)]]) {
                    fix[mas[(rand()%k)]]=1;
                    i++;
                }
            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;
        }
        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]);
    }
    return;
}/*
int main() {
    cin>>n;
    cin>>alo>>balo;
    go[alo][balo]=go[balo][alo]=1;
    run(n);
    return 0;
}*/

Compilation message

icc.cpp:2:10: warning: missing terminating " character
 #include "icc.h>
          ^
icc.cpp:2:10: error: #include expects "FILENAME" or <FILENAME>
 #include "icc.h>
          ^~~~~~~
icc.cpp: In function 'void run(int)':
icc.cpp:51:17: error: 'query' was not declared in this scope
             if (query(sa,sb,a,b))
                 ^~~~~
icc.cpp:61:17: error: 'query' was not declared in this scope
             if (query(m-l+1,sb,mas,b))
                 ^~~~~
icc.cpp:74:17: error: 'query' was not declared in this scope
             if (query(sa,m-l+1,a,mas))
                 ^~~~~
icc.cpp:83:9: error: 'setRoad' was not declared in this scope
         setRoad(b[l-1],a[x-1]);
         ^~~~~~~