답안 #604948

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
604948 2022-07-25T11:03:50 Z A_D CEOI16_icc (CEOI16_icc) C++14
0 / 100
110 ms 1700 KB
#include "icc.h"
#include <bits/stdc++.h>
using namespace std;
void run(int n) {
    vector<int> vec;
    int num=0;
    int cnt=0;
    set<pair<int,int>> edges;
    int hhhhhhhhhh=n-1;
    while(hhhhhhhhhh--){
        for(int a = 1; a <= n; ++a) {
            vec.clear();
            for(int b = a + 1; b <= n; ++b) {
                if(edges.count({a,b})==0||edges.count({b,a})==0){
                    vec.push_back(b);
                }
            }
            if(1){
                int sz=vec.size();
                int* arr1 = new int[1];
                arr1[0] = a;
                int* arr2 = new int[sz];
                for(int i=0;i<sz;i++){
                    arr2[i]=vec[i];
                }
                num++;
                if(num>1500)assert(0);
                if(query(1, sz, arr1, arr2)==0)continue;
            }
            while(vec.size()!=1){
                int sz=vec.size();
                int sz1=sz/2;
                int* arr1 = new int[1];
                arr1[0] = a;
                int* arr2 = new int[sz1];
                for(int i=0;i<sz1;i++){
                    arr2[i]=vec[i];
                }
                num++;
                if(num>1500)assert(0);
                if(query(1, sz1, arr1, arr2)==1){
                    while(vec.size()!=sz1)vec.pop_back();
                }
                else{
                    vector<int> vec2;
                    for(int i=sz1;i<sz;i++){
                        vec2.push_back(vec[i]);
                    }
                    vec=vec2;
                }
            }
            int* arr1 = new int[1];
            arr1[0] = a;
            int* arr2 = new int[1];
            arr2[0]=vec[0];
            num++;
            if(num>1500)assert(0);
            if(vec.size()!=1)assert(0);
            if(query(1, 1, arr1, arr2)==0)assert(0);
            if(edges.count({a,vec[0]})==1)assert(0);
            edges.insert({a,vec[0]});
            edges.insert({vec[0],a});
            setRoad(a, vec[0]);
            cnt++;
            break;
        }
    }
    if(cnt!=n-1){
        assert(0);
    }
}

Compilation message

icc.cpp: In function 'void run(int)':
icc.cpp:42:37: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |                     while(vec.size()!=sz1)vec.pop_back();
      |                           ~~~~~~~~~~^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 468 KB Ok! 160 queries used.
2 Incorrect 3 ms 468 KB Wrong road!
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 528 KB Wrong road!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 106 ms 1576 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 468 KB Wrong road!
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 110 ms 1700 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 105 ms 1584 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -