제출 #1331803

#제출 시각아이디문제언어결과실행 시간메모리
1331803Semicolon악어의 지하 도시 (IOI11_crocodile)C++17
컴파일 에러
0 ms0 KiB
/**
 *     Author: Lưu Diệp Thành (Save Diệp Thành)
 *     Le Hong Phong High School for the Gifted (i2528)
**/
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#define ll long long
#define ushort unsigned short
#define FOR(i,l,r) for(int i = (l), _r = (r); i <= _r; i++)
#define FORN(i,r,l) for(int i = (r), _l = (l); i >= _l; i--)
#define endl '\n'
#define sz(x) (int)x.size()
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define MASK(x) (1LL << (x))
#define BIT(x,i) (((x) >> (i)) & 1)
#define ins insert
#define segleft (id<<1)
#define segright (id<<1|1)
#define TIME  (1.0 * clock() / CLOCKS_PER_SEC)
const int MOD = 1e9+7;
const int INF = 1e9;

int travel_plan(int n, int m, int r[][2], int l[], int k, int p[N]) {
    vector<pair<int,int>> edge[n];
    FOR(i, 0, m-1) {
        edge[r[i][0]].pb({r[i][1], l[i]});
        edge[r[i][1]].pb({r[i][0], l[i]});
    }

    vector<pair<int,int>> dist(n, {INF, INF});
    priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> q;
    FOR(i, 0, k-1) {
        q.push({0, p[i]});
        dist[p[i]] = {0,0};
    }

    while(!q.empty()) {
        auto[du, u] = q.top(); q.pop();
        if (du > dist[u].se or du = INF) continue;

        for(auto[v,w] : edge[u]) {
            if (dist[v].fi > du + w) {
                dist[v].se = dist[v].fi;
                dist[v].fi = du + w;
                if (dist[v].se != INF) {
                    q.push({dist[v].se, v});
                }
            } else if (dist[v].se > du + w) {
                dist[v].se = du + w;
                q.push({dist[v].se, v});
            }
        }
    }

    return dist[0].se;
}

컴파일 시 표준 에러 (stderr) 메시지

crocodile.cpp:27:65: error: 'N' was not declared in this scope
   27 | int travel_plan(int n, int m, int r[][2], int l[], int k, int p[N]) {
      |                                                                 ^
crocodile.cpp: In function 'long long int travel_plan(...)':
crocodile.cpp:28:32: error: 'n' was not declared in this scope; did you mean 'yn'?
   28 |     vector<pair<int,int>> edge[n];
      |                                ^
      |                                yn
crocodile.cpp:29:15: error: 'm' was not declared in this scope
   29 |     FOR(i, 0, m-1) {
      |               ^
crocodile.cpp:10:43: note: in definition of macro 'FOR'
   10 | #define FOR(i,l,r) for(int i = (l), _r = (r); i <= _r; i++)
      |                                           ^
crocodile.cpp:30:9: error: 'edge' was not declared in this scope
   30 |         edge[r[i][0]].pb({r[i][1], l[i]});
      |         ^~~~
crocodile.cpp:30:14: error: 'r' was not declared in this scope; did you mean '_r'?
   30 |         edge[r[i][0]].pb({r[i][1], l[i]});
      |              ^
      |              _r
crocodile.cpp:30:36: error: 'l' was not declared in this scope
   30 |         edge[r[i][0]].pb({r[i][1], l[i]});
      |                                    ^
crocodile.cpp:36:15: error: 'k' was not declared in this scope
   36 |     FOR(i, 0, k-1) {
      |               ^
crocodile.cpp:10:43: note: in definition of macro 'FOR'
   10 | #define FOR(i,l,r) for(int i = (l), _r = (r); i <= _r; i++)
      |                                           ^
crocodile.cpp:37:20: error: 'p' was not declared in this scope
   37 |         q.push({0, p[i]});
      |                    ^
crocodile.cpp:37:15: error: no matching function for call to 'std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >::push(<brace-enclosed initializer list>)'
   37 |         q.push({0, p[i]});
      |         ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/13/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:157,
                 from crocodile.cpp:5:
/usr/include/c++/13/bits/stl_queue.h:738:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::vector<std::pair<long long int, long long int> >; _Compare = std::greater<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
  738 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/13/bits/stl_queue.h:738:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >::value_type&' {aka 'const std::pair<long long int, long long int>&'}
  738 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_queue.h:746:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::vector<std::pair<long long int, long long int> >; _Compare = std::greater<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
  746 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/13/bits/stl_queue.h:746:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
  746 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
crocodile.cpp:43:29: error: lvalue required as left operand of assignment
   43 |         if (du > dist[u].se or du = INF) continue;
      |             ~~~~~~~~~~~~~~~~^~~~~
crocodile.cpp:45:25: error: 'edge' was not declared in this scope
   45 |         for(auto[v,w] : edge[u]) {
      |                         ^~~~
crocodile.cpp:50:27: error: no matching function for call to 'std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >::push(<brace-enclosed initializer list>)'
   50 |                     q.push({dist[v].se, v});
      |                     ~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_queue.h:738:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::vector<std::pair<long long int, long long int> >; _Compare = std::greater<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
  738 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/13/bits/stl_queue.h:738:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >::value_type&' {aka 'const std::pair<long long int, long long int>&'}
  738 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_queue.h:746:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::vector<std::pair<long long int, long long int> >; _Compare = std::greater<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
  746 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/13/bits/stl_queue.h:746:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
  746 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
crocodile.cpp:54:23: error: no matching function for call to 'std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >::push(<brace-enclosed initializer list>)'
   54 |                 q.push({dist[v].se, v});
      |                 ~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_queue.h:738:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::vector<std::pair<long long int, long long int> >; _Compare = std::greater<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
  738 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/13/bits/stl_queue.h:738:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >::value_type&' {aka 'const std::pair<long long int, long long int>&'}
  738 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_queue.h:746:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::vector<std::pair<long long int, long long int> >; _Compare = std::greater<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
  746 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/13/bits/stl_queue.h:746:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<long long int, long long int>, std::vector<std::pair<long long int, long long int> >, std::greater<std::pair<long long int, long long int> > >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
  746 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~