Submission #39561

# Submission time Handle Problem Language Result Execution time Memory
39561 2018-01-16T14:09:51 Z igzi ICC (CEOI16_icc) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
include "icc.h"
#define maxN 101

using namespace std;
vector <int> v[maxN];
vector <int> x;
int N;

int Query(vector<int> &a, vector<int> &b) {
  int tmp[2][maxN];
  for (int i = 0; i < a.size(); ++i) tmp[0][i] = a[i];
  for (int i = 0; i < b.size(); ++i) tmp[1][i] = b[i];
  return query(a.size(), b.size(), tmp[0], tmp[1]);
}
void zameni(int m,int d){
    int i;
    for(i=0;i<m;i++){
        int r=i/d;
        if(r%2) swap(x[i],x[i+m]);
    }
}
pair <int,int> resi(vector <int> &a,vector <int> &b){
    pair <int,int> ans;
    ans=make_pair(-1,-1);
    int i;
    vector <int> s;
    int A,B;
    A=a.size();
    B=b.size();
    int l=0,d=A,m;
    while(d!=l){
        m=(l+d)/2;
        for(i=l;i<m;i++){
            s.push_back(a[i]);
        }
        if(Query(b,s)) d=m;
        else l=m+1;
        s.clear();
    }
    ans.first=a[l];
    l=0,d=B;
    while(d!=l){
        m=(l+d)/2;
        for(i=l;i<m;i++){
            s.push_back(b[i]);
        }
        if(Query(a,s)) d=m;
        else l=m+1;
        s.clear();
    }
    ans.second=b[l];
    return ans;
}
void spoj(int a,int b){
    int i;
    if(a>b) swap(a,b);
    for(i=0;i<v[b].size();i++){
        v[a].push_back(v[b][i]);
    }
    v[b].clear();
}

void run(int n){
    N=n;
    int i,A=0,B=0,s;
    vector <int> a,b;
    for(i=1;i<=N;i++){
        v[i].push_back(i);
    }
    while(n>1){
        s=n & -n;
        if(s=n) s/=2;
        for(i=1;i<=N;i++){
            if(!v[i].empty()) x.push_back(i);
        }
        for(i=x.size();i<2*s;i++){
            x.push_back(-1);
        }
        for(i=0;i<s;i++){
            if(x[i]>=1 && x[i]<=N) a.push_back(x[i]);
        }
        for(i=s;i<x.size();i++){
            if(x[i]>=1 && x[i]<=N) b.push_back(x[i]);
        }
        int m=s,d=m/2;
        while(d>0 && !Query(a,b)){
            zameni(m,d);
            a.clear(); b.clear();
            for(i=0;i<s;i++){
            if(x[i]>=1 && x[i]<=N) a.push_back(x[i]);
        }
        for(i=s;i<x.size();i++){
            if(x[i]>=1 && x[i]<=N) b.push_back(x[i]);
        }
        d/=2;
        }
        pair <int,int> r;
        r=make_pair(1,1);
        r=resi(a,b);
        setRoad(r.first,r.second);
        spoj(r.first,r.second);
        n--;
    }
}

Compilation message

icc.cpp:2:1: error: 'include' does not name a type
 include "icc.h"
 ^
icc.cpp:6:1: error: 'vector' does not name a type
 vector <int> v[maxN];
 ^
icc.cpp:7:1: error: 'vector' does not name a type
 vector <int> x;
 ^
icc.cpp:10:11: error: 'vector' was not declared in this scope
 int Query(vector<int> &a, vector<int> &b) {
           ^
icc.cpp:10:11: note: suggested alternative:
In file included from /usr/include/c++/5/vector:64:0,
                 from /usr/include/c++/5/bits/random.h:34,
                 from /usr/include/c++/5/random:49,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from icc.cpp:1:
/usr/include/c++/5/bits/stl_vector.h:214:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^
icc.cpp:10:18: error: expected primary-expression before 'int'
 int Query(vector<int> &a, vector<int> &b) {
                  ^
icc.cpp:10:27: error: 'vector' was not declared in this scope
 int Query(vector<int> &a, vector<int> &b) {
                           ^
icc.cpp:10:27: note: suggested alternative:
In file included from /usr/include/c++/5/vector:64:0,
                 from /usr/include/c++/5/bits/random.h:34,
                 from /usr/include/c++/5/random:49,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from icc.cpp:1:
/usr/include/c++/5/bits/stl_vector.h:214:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^
icc.cpp:10:34: error: expected primary-expression before 'int'
 int Query(vector<int> &a, vector<int> &b) {
                                  ^
icc.cpp:10:41: error: expression list treated as compound expression in initializer [-fpermissive]
 int Query(vector<int> &a, vector<int> &b) {
                                         ^
icc.cpp:10:43: error: expected ',' or ';' before '{' token
 int Query(vector<int> &a, vector<int> &b) {
                                           ^
icc.cpp: In function 'void zameni(int, int)':
icc.cpp:20:22: error: 'x' was not declared in this scope
         if(r%2) swap(x[i],x[i+m]);
                      ^
icc.cpp:20:33: error: 'swap' was not declared in this scope
         if(r%2) swap(x[i],x[i+m]);
                                 ^
icc.cpp:20:33: note: suggested alternatives:
In file included from /usr/include/c++/5/complex:45:0,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from icc.cpp:1:
/usr/include/c++/5/sstream:783:5: note:   'std::__cxx11::swap'
     swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
     ^
In file included from /usr/include/c++/5/regex:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:108,
                 from icc.cpp:1:
/usr/include/c++/5/bits/regex.h:1952:5: note:   'std::__cxx11::swap'
     swap(match_results<_Bi_iter, _Alloc>& __lhs,
     ^
In file included from /usr/include/c++/5/exception:162:0,
                 from /usr/include/c++/5/ios:39,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from icc.cpp:1:
/usr/include/c++/5/bits/exception_ptr.h:160:5: note:   'std::__exception_ptr::swap'
     swap(exception_ptr& __lhs, exception_ptr& __rhs)
     ^
icc.cpp: At global scope:
icc.cpp:23:1: error: 'pair' does not name a type
 pair <int,int> resi(vector <int> &a,vector <int> &b){
 ^
icc.cpp: In function 'void spoj(int, int)':
icc.cpp:57:21: error: 'swap' was not declared in this scope
     if(a>b) swap(a,b);
                     ^
icc.cpp:57:21: note: suggested alternatives:
In file included from /usr/include/c++/5/complex:45:0,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from icc.cpp:1:
/usr/include/c++/5/sstream:783:5: note:   'std::__cxx11::swap'
     swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
     ^
In file included from /usr/include/c++/5/regex:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:108,
                 from icc.cpp:1:
/usr/include/c++/5/bits/regex.h:1952:5: note:   'std::__cxx11::swap'
     swap(match_results<_Bi_iter, _Alloc>& __lhs,
     ^
In file included from /usr/include/c++/5/exception:162:0,
                 from /usr/include/c++/5/ios:39,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from icc.cpp:1:
/usr/include/c++/5/bits/exception_ptr.h:160:5: note:   'std::__exception_ptr::swap'
     swap(exception_ptr& __lhs, exception_ptr& __rhs)
     ^
icc.cpp:58:15: error: 'v' was not declared in this scope
     for(i=0;i<v[b].size();i++){
               ^
icc.cpp:61:5: error: 'v' was not declared in this scope
     v[b].clear();
     ^
icc.cpp: In function 'void run(int)':
icc.cpp:67:5: error: 'vector' was not declared in this scope
     vector <int> a,b;
     ^
icc.cpp:67:5: note: suggested alternative:
In file included from /usr/include/c++/5/vector:64:0,
                 from /usr/include/c++/5/bits/random.h:34,
                 from /usr/include/c++/5/random:49,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from icc.cpp:1:
/usr/include/c++/5/bits/stl_vector.h:214:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^
icc.cpp:67:13: error: expected primary-expression before 'int'
     vector <int> a,b;
             ^
icc.cpp:69:9: error: 'v' was not declared in this scope
         v[i].push_back(i);
         ^
icc.cpp:73:15: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
         if(s=n) s/=2;
               ^
icc.cpp:75:17: error: 'v' was not declared in this scope
             if(!v[i].empty()) x.push_back(i);
                 ^
icc.cpp:75:31: error: 'x' was not declared in this scope
             if(!v[i].empty()) x.push_back(i);
                               ^
icc.cpp:77:15: error: 'x' was not declared in this scope
         for(i=x.size();i<2*s;i++){
               ^
icc.cpp:81:16: error: 'x' was not declared in this scope
             if(x[i]>=1 && x[i]<=N) a.push_back(x[i]);
                ^
icc.cpp:81:36: error: 'a' was not declared in this scope
             if(x[i]>=1 && x[i]<=N) a.push_back(x[i]);
                                    ^
icc.cpp:83:19: error: 'x' was not declared in this scope
         for(i=s;i<x.size();i++){
                   ^
icc.cpp:84:36: error: 'b' was not declared in this scope
             if(x[i]>=1 && x[i]<=N) b.push_back(x[i]);
                                    ^
icc.cpp:87:29: error: 'a' was not declared in this scope
         while(d>0 && !Query(a,b)){
                             ^
icc.cpp:87:31: error: 'b' was not declared in this scope
         while(d>0 && !Query(a,b)){
                               ^
icc.cpp:87:32: error: 'Query' cannot be used as a function
         while(d>0 && !Query(a,b)){
                                ^
icc.cpp:91:16: error: 'x' was not declared in this scope
             if(x[i]>=1 && x[i]<=N) a.push_back(x[i]);
                ^
icc.cpp:93:19: error: 'x' was not declared in this scope
         for(i=s;i<x.size();i++){
                   ^
icc.cpp:98:9: error: 'pair' was not declared in this scope
         pair <int,int> r;
         ^
icc.cpp:98:9: note: suggested alternative:
In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from icc.cpp:1:
/usr/include/c++/5/bits/stl_pair.h:96:12: note:   'std::pair'
     struct pair
            ^
icc.cpp:98:15: error: expected primary-expression before 'int'
         pair <int,int> r;
               ^
icc.cpp:99:9: error: 'r' was not declared in this scope
         r=make_pair(1,1);
         ^
icc.cpp:99:24: error: 'make_pair' was not declared in this scope
         r=make_pair(1,1);
                        ^
icc.cpp:99:24: note: suggested alternative:
In file included from /usr/include/c++/5/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/5/bits/char_traits.h:39,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from icc.cpp:1:
/usr/include/c++/5/bits/stl_pair.h:276:5: note:   'std::make_pair'
     make_pair(_T1&& __x, _T2&& __y)
     ^
icc.cpp:100:16: error: 'a' was not declared in this scope
         r=resi(a,b);
                ^
icc.cpp:100:18: error: 'b' was not declared in this scope
         r=resi(a,b);
                  ^
icc.cpp:100:19: error: 'resi' was not declared in this scope
         r=resi(a,b);
                   ^
icc.cpp:101:33: error: 'setRoad' was not declared in this scope
         setRoad(r.first,r.second);
                                 ^
icc.cpp:66:11: warning: unused variable 'A' [-Wunused-variable]
     int i,A=0,B=0,s;
           ^
icc.cpp:66:15: warning: unused variable 'B' [-Wunused-variable]
     int i,A=0,B=0,s;
               ^