Submission #508871

# Submission time Handle Problem Language Result Execution time Memory
508871 2022-01-14T00:34:06 Z couplefire Meetings (JOI19_meetings) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

mt19937 rng(chrono::steady_clock().now().time_since_epoch().count());
vector<vector<int>> stuff;

void calc(vector<int> v){
    if((int)v.size()==1) return;
    int n = v.size();
    shuffle(v.begin(), v.end(), rng);
    int a = v[0], b = v[1];
    vector<int> path = {a, b};
    for(int i = 2; i<n; ++i)
        if(Query(a, b, v[i])==v[i])
            path.push_back(v[i]);
    sort(path.begin(), path.end(), [&](int x, int y){
        if(a==x) return true;
        if(a==y) return false;
        return Query(a, x, y)==x;
    });
    for(int i = 0; i<(int)path.size()-1; ++i)
        Bridge(min(path[i], path[i+1]), max(path[i], path[i+1]));
    for(auto x : path)
        stuff[x].clear();
    stuff[a] = {a}; stuff[b] = {b};
    for(int i = 2; i<n; ++i)
        stuff[Query(a, b, v[i])].push_back(v[i]);
    for(auto x : path)
        calc(stuff[x]);
}

void Solve(int n){
    vector<int> v(n);
    iota(v.begin(), v.end(), 0);
    stuff.resize(n); calc(v);
}

Compilation message

meetings.cpp: In function 'void calc(std::vector<int>)':
meetings.cpp:14:12: error: 'Query' was not declared in this scope
   14 |         if(Query(a, b, v[i])==v[i])
      |            ^~~~~
meetings.cpp: In lambda function:
meetings.cpp:19:16: error: 'Query' was not declared in this scope
   19 |         return Query(a, x, y)==x;
      |                ^~~~~
meetings.cpp: In function 'void calc(std::vector<int>)':
meetings.cpp:22:9: error: 'Bridge' was not declared in this scope
   22 |         Bridge(min(path[i], path[i+1]), max(path[i], path[i+1]));
      |         ^~~~~~
meetings.cpp:27:15: error: 'Query' was not declared in this scope
   27 |         stuff[Query(a, b, v[i])].push_back(v[i]);
      |               ^~~~~