Submission #585554

# Submission time Handle Problem Language Result Execution time Memory
585554 2022-06-29T05:03:14 Z 조영욱(#8387) ICC (CEOI16_icc) C++14
Compilation error
0 ms 0 KB
#include "icc.h"
#include <bits/stdc++.h>
using namespace std;

bool tree[101];
        vector<int> in;
        vector<int> out;

typedef pair<int,int> P;

int temp1[101];
int temp2[101];

bool que(vector<int> one,vector<int> two) {
    for(int i=0;i<one.size();i++) {
        temp1[i]=one[i];
    }
    for(int i=0;i<two.size();i++) {
        temp2[i]=two[i];
    }
    if (one.empty()||two.empty()) {
        return false;
    }
    return query(one.size(),two.size(),temp1,temp2);
}

P f1() {
    int xo=0; //a^b
    for(int bit=0;bit<7;bit++) {
        vector<int> one;
        vector<int> two;
        for(int i=1;i<=n;i++) {
            if (!tree[i]) {
                if (bit&(1<<i)) {
                    one.push_back(i);
                }
                else {
                    two.push_back(i);
                }
            }
        }
        if (que(one,two)) {
            xo+=(1<<bit);
        }
    }
    vector<int> one;
    vector<int> two;
    for(int i=1;i<=n;i++) {
        if (tree[i]) {
            continue;
        }
        int nt=(i^xo);
        if (nt<=n&&!tree[nt]&&i<nt) {
            one.push_back(i);
        }
        if (nt<=n&&!tree[nt]&&i>nt) {
            two.push_back(i);
        }
    }
    int l=0;
    int r=two.size()-1;
    while (l<r) {
        int mid=(l+r)/2;
        vector<int> temp;
        for(int i=l;i<=mid;i++) {
            temp.push_back(two[i]);
        }
        if (que(one,temp)) {
            r=mid;
        }
        else {
            l=mid+1;
        }
    }
    return P(two[l],two[l]^xo);
}

P f2() {
    int l=0;
    int r=in.size()-1;
    while (l<r) {
        int mid=(l+r)/2;
        vector<int> temp;
        for(int i=l;i<=mid;i++) {
            temp.push_back(in[i]);
        }
        if (que(temp,out)) {
            r=mid;
        }
        else {
            l=mid+1;
        }
    }
    int one=in[l];
    l=0;
    r=out.size()-1;
    while (l<r) {
        int mid=(l+r)/2;
        vector<int> temp;
        for(int i=l;i<=mid;i++) {
            temp.push_back(out[i]);
        }
        if (que(in,temp)) {
            r=mid;
        }
        else {
            l=mid+1;
        }
    }
    int two=out[l];
    return P(one,two);
}

void run(int n) {
    for(int i=0;i<n-1;i++) {
        in.clear();
        out.clear();
        for(int j=1;j<=n;j++) {
            if (tree[j]) {
                in.push_back(j);
            }
            else {
                out.push_back(j);
            }
        }
        P got;
        if (que(in,out)) {
            got=f2();
        }
        else {
            got=f1();
        }
        SetRoad(got.first,got.second);
    }
}

Compilation message

icc.cpp: In function 'bool que(std::vector<int>, std::vector<int>)':
icc.cpp:15:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for(int i=0;i<one.size();i++) {
      |                 ~^~~~~~~~~~~
icc.cpp:18:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int i=0;i<two.size();i++) {
      |                 ~^~~~~~~~~~~
icc.cpp: In function 'P f1()':
icc.cpp:32:24: error: 'n' was not declared in this scope
   32 |         for(int i=1;i<=n;i++) {
      |                        ^
icc.cpp:48:20: error: 'n' was not declared in this scope
   48 |     for(int i=1;i<=n;i++) {
      |                    ^
icc.cpp: In function 'void run(int)':
icc.cpp:133:9: error: 'SetRoad' was not declared in this scope; did you mean 'setRoad'?
  133 |         SetRoad(got.first,got.second);
      |         ^~~~~~~
      |         setRoad