Submission #99298

# Submission time Handle Problem Language Result Execution time Memory
99298 2019-03-02T09:14:49 Z Mercenary ICC (CEOI16_icc) C++14
Compilation error
0 ms 0 KB
#ifndef __GRADER_CPP__
#define __GRADER_CPP__

//#include "graderlib.cpp"
#include "icc.h"
const int maxn = 105;

vector<int> P[maxn];

int papa[maxn];

int Cal(vector<int> a , vector<int> b)
{
    int n = a.size();
    if(n == 1)return a[0];
    vector<int> tmp;
    int mid = n / 2;
    for(int i = 0 ; i < mid ; ++i)tmp.push_back(a[i]);
    if(query(tmp.size(),b.size(),tmp.data(),b.data())){
        return Cal(tmp,b);
    }
    tmp.clear();
    for(int i = mid ; i < n ; ++i)tmp.push_back(a[i]);
    return Cal(tmp,b);
}

void run(int n)
{
    for(int i = 1 ; i <= n ; ++i)P[i].push_back(i) , papa[i] = i;
    for(int i = n ; i > 1 ; --i)
    {
        vector<int> a , b;
        for(int j = 0 ; j < 10 ; ++j)
        {
            for(int k = 1 ; k <= i ; ++k)
            {
                if((k >> j) & 1)for(int c : P[k])a.push_back(c);
                else for(int c : P[k])b.push_back(c);
            }
        }
        if(query(a.size(),b.size(),a.data(),b.data()));
        int u  = Cal(a , b);
        int v = Cal(b , a);
        setRoad(u,v);
        u = papa[u];
        v = papa[v];
        if(u > v)swap(u,v);
        for(int c : P[v])papa[c] = u , P[u].push_back(c);
        break;
    }
}

//int main() {
//    using namespace ceoi_2016;
//    InitGrader();
//
//    run(NumVertices());
//
//    GraderExitFail();
//    printf("SUCCESS");
//    return 0;
//}
//
//#endif // __GRADER_CPP__

Compilation message

icc.cpp:1:0: error: unterminated #ifndef
 #ifndef __GRADER_CPP__
 
icc.cpp:8:1: error: 'vector' does not name a type
 vector<int> P[maxn];
 ^~~~~~
icc.cpp:12:9: error: 'vector' was not declared in this scope
 int Cal(vector<int> a , vector<int> b)
         ^~~~~~
icc.cpp:12:16: error: expected primary-expression before 'int'
 int Cal(vector<int> a , vector<int> b)
                ^~~
icc.cpp:12:25: error: 'vector' was not declared in this scope
 int Cal(vector<int> a , vector<int> b)
                         ^~~~~~
icc.cpp:12:32: error: expected primary-expression before 'int'
 int Cal(vector<int> a , vector<int> b)
                                ^~~
icc.cpp:12:38: error: expression list treated as compound expression in initializer [-fpermissive]
 int Cal(vector<int> a , vector<int> b)
                                      ^
icc.cpp: In function 'void run(int)':
icc.cpp:29:34: error: 'P' was not declared in this scope
     for(int i = 1 ; i <= n ; ++i)P[i].push_back(i) , papa[i] = i;
                                  ^
icc.cpp:32:9: error: 'vector' was not declared in this scope
         vector<int> a , b;
         ^~~~~~
icc.cpp:32:16: error: expected primary-expression before 'int'
         vector<int> a , b;
                ^~~
icc.cpp:37:45: error: 'P' was not declared in this scope
                 if((k >> j) & 1)for(int c : P[k])a.push_back(c);
                                             ^
icc.cpp:37:50: error: 'a' was not declared in this scope
                 if((k >> j) & 1)for(int c : P[k])a.push_back(c);
                                                  ^
icc.cpp:38:34: error: 'P' was not declared in this scope
                 else for(int c : P[k])b.push_back(c);
                                  ^
icc.cpp:38:39: error: 'b' was not declared in this scope
                 else for(int c : P[k])b.push_back(c);
                                       ^
icc.cpp:41:18: error: 'a' was not declared in this scope
         if(query(a.size(),b.size(),a.data(),b.data()));
                  ^
icc.cpp:41:27: error: 'b' was not declared in this scope
         if(query(a.size(),b.size(),a.data(),b.data()));
                           ^
icc.cpp:42:22: error: 'a' was not declared in this scope
         int u  = Cal(a , b);
                      ^
icc.cpp:42:26: error: 'b' was not declared in this scope
         int u  = Cal(a , b);
                          ^
icc.cpp:42:27: error: 'Cal' cannot be used as a function
         int u  = Cal(a , b);
                           ^
icc.cpp:43:26: error: 'Cal' cannot be used as a function
         int v = Cal(b , a);
                          ^
icc.cpp:47:18: error: 'swap' was not declared in this scope
         if(u > v)swap(u,v);
                  ^~~~
icc.cpp:48:21: error: 'P' was not declared in this scope
         for(int c : P[v])papa[c] = u , P[u].push_back(c);
                     ^