Submission #961856

# Submission time Handle Problem Language Result Execution time Memory
961856 2024-04-12T14:57:50 Z Sharky Stray Cat (JOI20_stray) C++17
Compilation error
0 ms 0 KB
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;

namespace ivan {
    const int INF = 1e9;
    vector<vector<pair<int, int>>> adj;
    vector<int> dist, c;
    vector<pair<int, int>> e;
    queue<int> q;
    vector<bool> vis;
};

using namespace ivan;

vector<int> Mark(int n, int m, int a, int b,
                      vector<int> u, vector<int> v) {
    vector<int> x(m);
    adj.resize(n);
    c.resize(m);
    dist.assign(n, INF);
    vis.assign(n, 0);
    for (int i = 0; i < m; i++) {
        adj[u[i]].push_back({v[i], i});
        adj[v[i]].push_back({u[i], i});
        e.push_back({u[i], v[i]});
    }
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (auto& [v, id] : adj[u]) {
            if (dist[v] > dist[u] + 1) {
                dist[v] = dist[u] + 1;
                q.push({dist[v], v});
            }
        }
    }
    for (int i = 0; i < e.size(); i++) c[i] = min(dist[e[i].fi], dist[e[i].se]) % 3;
    return c;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;

namespace ivan {
    int a, b;
};

using namespace ivan;

void Init(int A, int B) {
    a = A, b = B;
}

int Move(vector<int> cnt) {
    set<int> hv;
    for (int i = 0; i < a; i++) if (cnt[i]) hv.insert(i);
    if ((int) hv.size() == 1) return *hv.begin();
    if (!hv.count(1)) return 2;
    if (!hv.count(2)) return 0;
    if (!hv.count(0)) return 1;
}

Compilation message

Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:34:36: error: no matching function for call to 'std::queue<int>::push(<brace-enclosed initializer list>)'
   34 |                 q.push({dist[v], v});
      |                                    ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from Anthony.cpp:2:
/usr/include/c++/10/bits/stl_queue.h:265:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; std::queue<_Tp, _Sequence>::value_type = int]'
  265 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:265:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const int&'}
  265 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_queue.h:270:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; std::queue<_Tp, _Sequence>::value_type = int]'
  270 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:270:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<int>::value_type&&' {aka 'int&&'}
  270 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
Anthony.cpp:38:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for (int i = 0; i < e.size(); i++) c[i] = min(dist[e[i].fi], dist[e[i].se]) % 3;
      |                     ~~^~~~~~~~~~
Anthony.cpp:38:61: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'fi'
   38 |     for (int i = 0; i < e.size(); i++) c[i] = min(dist[e[i].fi], dist[e[i].se]) % 3;
      |                                                             ^~
Anthony.cpp:38:76: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'se'
   38 |     for (int i = 0; i < e.size(); i++) c[i] = min(dist[e[i].fi], dist[e[i].se]) % 3;
      |                                                                            ^~

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:16:14: warning: control reaches end of non-void function [-Wreturn-type]
   16 |     set<int> hv;
      |              ^~