Submission #1212871

#TimeUsernameProblemLanguageResultExecution timeMemory
1212871BigBadBullyArt Collections (BOI22_art)C++20
Compilation error
0 ms0 KiB
void solve(signed N)
{
    int n = N;
    auto comp = [&](int x,int y)->bool
    {
        //x < y
        vector<int> tr;
        tr.push_back(x+1);
        tr.push_back(y+1);
        for (int i = 0; i < n; i++)
            if (i != x && i != y)
                tr.push_back(i+1);
        int a = publish(tr);
        swap(tr[0],tr[1]);
        int b = publish(tr);
        return a < b;
    };
    function<vector<int>(vector<int>)> srt = [&](vector<int> v)->vector<int>
    {
        vector<int> a,b;
        if (v.size()<=1)
            return v;
        int piv = rand()%(v.size());
        for (int i = 0; i < v.size(); i++)
        {
            if (i == piv)
                continue;
            if (comp(v[piv],v[i]))
                b.push_back(v[i]);
            else
                a.push_back(v[i]);
        }
        vector<int> res;
        res = srt(a);
        res.push_back(v[piv]);
        auto vec = srt(b);
        for (int x:vec)
            res.push_back(x);
        return res;
    };
    vector<int> bs(n,0);
    for (int i = 0; i < n; i++)
        bs[i] = i;
    auto ans = srt(bs);
    for (int&x:ans)x++;
    answer(ans);
    
};

Compilation message (stderr)

art.cpp: In lambda function:
art.cpp:7:9: error: 'vector' was not declared in this scope
    7 |         vector<int> tr;
      |         ^~~~~~
art.cpp:7:16: error: expected primary-expression before 'int'
    7 |         vector<int> tr;
      |                ^~~
art.cpp:8:9: error: 'tr' was not declared in this scope
    8 |         tr.push_back(x+1);
      |         ^~
art.cpp:13:17: error: 'publish' was not declared in this scope
   13 |         int a = publish(tr);
      |                 ^~~~~~~
art.cpp:14:9: error: 'swap' was not declared in this scope
   14 |         swap(tr[0],tr[1]);
      |         ^~~~
art.cpp: In function 'void solve(int)':
art.cpp:18:26: error: 'vector' was not declared in this scope
   18 |     function<vector<int>(vector<int>)> srt = [&](vector<int> v)->vector<int>
      |                          ^~~~~~
art.cpp:18:14: error: 'vector' was not declared in this scope
   18 |     function<vector<int>(vector<int>)> srt = [&](vector<int> v)->vector<int>
      |              ^~~~~~~~~~~
art.cpp:18:14: error: 'vector' was not declared in this scope
art.cpp:18:14: error: 'vector' was not declared in this scope
art.cpp:18:14: error: 'vector' was not declared in this scope
art.cpp:18:14: error: 'vector' was not declared in this scope
art.cpp:18:14: error: 'vector' was not declared in this scope
art.cpp:18:14: error: 'vector' was not declared in this scope
art.cpp:18:14: error: 'vector' was not declared in this scope
art.cpp:18:14: error: 'vector' was not declared in this scope
art.cpp:18:5: error: 'function' was not declared in this scope; did you mean 'union'?
   18 |     function<vector<int>(vector<int>)> srt = [&](vector<int> v)->vector<int>
      |     ^~~~~~~~
      |     union
art.cpp:18:33: error: expected primary-expression before 'int'
   18 |     function<vector<int>(vector<int>)> srt = [&](vector<int> v)->vector<int>
      |                                 ^~~
art.cpp:18:14: error: 'vector' was not declared in this scope
   18 |     function<vector<int>(vector<int>)> srt = [&](vector<int> v)->vector<int>
      |              ^~~~~~~~~~~
art.cpp:18:40: error: 'srt' was not declared in this scope
   18 |     function<vector<int>(vector<int>)> srt = [&](vector<int> v)->vector<int>
      |                                        ^~~
art.cpp:18:50: error: 'vector' is not a type
   18 |     function<vector<int>(vector<int>)> srt = [&](vector<int> v)->vector<int>
      |                                                  ^~~~~~
art.cpp:18:56: error: expected ',' or '...' before '<' token
   18 |     function<vector<int>(vector<int>)> srt = [&](vector<int> v)->vector<int>
      |                                                        ^
art.cpp:18:66: error: 'vector' does not name a type
   18 |     function<vector<int>(vector<int>)> srt = [&](vector<int> v)->vector<int>
      |                                                                  ^~~~~~
art.cpp:18:72: error: expected '{' before '<' token
   18 |     function<vector<int>(vector<int>)> srt = [&](vector<int> v)->vector<int>
      |                                                                        ^
art.cpp:18:73: error: expected primary-expression before 'int'
   18 |     function<vector<int>(vector<int>)> srt = [&](vector<int> v)->vector<int>
      |                                                                         ^~~
art.cpp:41:12: error: expected primary-expression before 'int'
   41 |     vector<int> bs(n,0);
      |            ^~~
art.cpp:43:9: error: 'bs' was not declared in this scope
   43 |         bs[i] = i;
      |         ^~
art.cpp:44:20: error: 'bs' was not declared in this scope
   44 |     auto ans = srt(bs);
      |                    ^~
art.cpp:46:5: error: 'answer' was not declared in this scope
   46 |     answer(ans);
      |     ^~~~~~