Submission #604937

# Submission time Handle Problem Language Result Execution time Memory
604937 2022-07-25T10:55:59 Z A_D ICC (CEOI16_icc) C++14
0 / 100
123 ms 1576 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(query(1, 1, arr1, arr2)==0)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 Correct 7 ms 468 KB Ok! 160 queries used.
2 Incorrect 3 ms 468 KB Wrong road!
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 516 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 123 ms 1524 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 536 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 109 ms 1576 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 115 ms 1456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -