Submission #604929

# Submission time Handle Problem Language Result Execution time Memory
604929 2022-07-25T10:53:26 Z A_D ICC (CEOI16_icc) C++14
0 / 100
10 ms 852 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){
                    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(query(1, 1, arr1, arr2)==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();
      |                           ~~~~~~~~~~^~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 724 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 852 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 768 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 760 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 852 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 852 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -