답안 #101236

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
101236 2019-03-18T03:04:28 Z jamielim CEOI16_icc (CEOI16_icc) C++14
0 / 100
331 ms 592 KB
#include <bits/stdc++.h>
#include "icc.h"
using namespace std;

int par[105];
int root(int x){return par[x]=(par[x]==x?x:root(par[x]));}

void run(int n){
    for(int i=1;i<=n;i++){
        par[i]=i;
    }
    for(int i=0;i<n-1;i++){
        vector<int> sets[n+1];
        for(int j=1;j<=n;j++){
            sets[root(j)].push_back(j);
        }
        bool found=false;
        for(int j=1;j<=n;j++){
            if((int)sets[j].size()==0)continue;
            int a[(int)sets[j].size()];
            for(int k=0;k<(int)sets[j].size();k++){
                a[k]=sets[j][k];
            }
            for(int k=j+1;k<=n;k++){
                if((int)sets[k].size()==0)continue;
                int b[(int)sets[k].size()];
                for(int l=0;l<(int)sets[k].size();l++){
                    b[l]=sets[k][l];
                }
                if(query((int)sets[j].size(),(int)sets[k].size(),a,b)){
                    found=true;
                    int A[1],B[1];
                    for(int x=0;x<sets[j].size();x++){
                        A[0]=sets[j][x];
                        for(int y=0;y<sets[k].size();y++){
                            B[0]=sets[k][y];
                            if(query(1,1,A,B)){
                                setRoad(A[0],B[0]);
                                par[j]=k;
                            }
                        }
                    }
                    break;
                }
            }
            if(found)break;
        }
        if(found)continue;
    }
}

Compilation message

icc.cpp: In function 'void run(int)':
icc.cpp:33:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     for(int x=0;x<sets[j].size();x++){
                                 ~^~~~~~~~~~~~~~~
icc.cpp:35:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                         for(int y=0;y<sets[k].size();y++){
                                     ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 512 KB Ok! 665 queries used.
2 Incorrect 23 ms 560 KB Wrong road!
# 결과 실행 시간 메모리 Grader output
1 Incorrect 213 ms 592 KB Wrong road!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 330 ms 552 KB Number of queries more than 4500 out of 2250
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 331 ms 560 KB Number of queries more than 4000 out of 2000
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 271 ms 560 KB Number of queries more than 3550 out of 1775
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 245 ms 512 KB Number of queries more than 3250 out of 1625
2 Halted 0 ms 0 KB -