Submission #799008

# Submission time Handle Problem Language Result Execution time Memory
799008 2023-07-31T08:37:29 Z burythelightdeepwithin Stray Cat (JOI20_stray) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "Anthony.h"

using namespace std;

vector <pair <int, int> > adj[20003], adj_dfs[20003];
vector <int> plan;
int vs[20003];
queue <int> q;
vector <int> leaf;

void bfs(){
    while(!q.empty()){
        int u = q.front();
        vs[u] = 1;
        q.pop();
        for (auto e: adj[u]){
            int v = e.first, id = e.second;
            if (!vs[v]){
                q.push(v);
                vs[v] = 1;
                adj_dfs[u].push_back({v, id});
                adj_dfs[v].push_back({u, id});
            }
        }
    }
}

void dfs(int u, int mark){
    vs[u] = 1;
    for (auto e: adj[u]){
        int v = e.first, id = e.second;
        if (!vs[v]){
            plan[id] = mark;
            dfs(v, (mark^1));
        }
    }
}

vector <int> Mark(int N, int M, int A, int B, vector<int> U, vector <int> V){
    for (int i = 0; i < M; i++){
        adj[U[i]].push_back(V[i], i);
        adj[V[i]].push_back(U[i], i);
        plan.push_back(-1);
    }
    q.push(0);
    bfs();
    for (int i = 0; i < N; i++){
        vs[i] = 0;
    }
    dfs(0, 0);
    for (int i = 0; i < M; i++){
        if (plan[i] == -1){
            plan[i] = 2;
        }
    }
    return plan;
}
#include <bits/stdc++.h>
#include "Catherine.h"

using namespace std;

int first = -1, last = -1, cnt = 0;

void Init(int A, int B){

}

int Move(vector <int> y){
    if (first == -1){
        if (last == -1){
            if (y[0] > y[1]){
                first = 1;
                cnt++;
                return 1;
            } else if (y[0] < y[1]){
                first = 0;
                cnt++;
                return 0;
            } else {
                last = 0;
                return 0;
            }
        } else {
            if (y[last^1] > 1){
                first = last^1;
                return -1;
            } else {
                last ^= 1;
                return last;
            }
        }
    } else {
        first ^= 1;
        return first;
    }
}

Compilation message

Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:42:36: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, int&)'
   42 |         adj[U[i]].push_back(V[i], i);
      |                                    ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from Anthony.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note:   candidate expects 1 argument, 2 provided
Anthony.cpp:43:36: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, int&)'
   43 |         adj[V[i]].push_back(U[i], i);
      |                                    ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from Anthony.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note:   candidate expects 1 argument, 2 provided