Submission #1107459

# Submission time Handle Problem Language Result Execution time Memory
1107459 2024-11-01T09:13:58 Z chaoslong Crocodile's Underground City (IOI11_crocodile) C++14
Compilation error
0 ms 0 KB
// Calm down.
// Think three times, code twice.
#include "bits/stdc++.h"
#include "crocodile.h"
#define forr(_a,_b,_c) for(int _a = (_b); _a <= (_c); ++_a)
#define ford(_a,_b,_c) for(int _a = (_b) + 1; _a --> (_c);)
#define forf(_a,_b,_c) for(int _a = (_b); _a < (_c); ++_a)
#define st first
#define nd second
#define ll long long
#define ull unsigned long long
#define pii pair <ll,int>
#define pll pair <ll,ll>
#define piii pair <int,pii>
#define vi vector <int>
#define pb push_back
#define mp make_pair
#define all(x) begin(x),end(x)
#define mask(i) (1LL << (i))
#define bit(x, i) (((x) >> (i)) & 1)
#define bp __builtin_popcountll
#define file "test"

using namespace std;
const int N = 1000 + 5;
const int mod = 1e9 + 7; // 998244353
const ll oo = 1e18;

ll d[N][2];
bool check[N];
vector<pii> a[N];

void dfs(int u, int par) {
    for(pii e: a[u]) {
        int v = e.nd; ll dv = e.st;
        if(v == par) continue;
        dfs(v, u);
        if(check[v]) {
            if(dv < d[u][0]) {
                d[u][0] = dv;
            } else if(dv < d[u][1]) {
                d[u][1] = dv;
            }
        }
        if(d[v][1] < d[u][0]) {
            d[u][0] = d[v][1];
        } else if(d[v][1] < d[u][1]) {
            d[u][1] = d[v][1];
        }
    }
}

int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) {
    forf(i, 0, m) {
        a[r[i][0]].pb({l[i], a[r[i][1]]});
        a[r[i][1]].pb({l[i], a[r[i][0]]});
    }
    forf(i, 0, k) check[p[i]] = 1;
    memset(d, 63, sizeof d);
    dfs(0, 0);
    return d[0][2];
}

//signed main(){
//    ios_base::sync_with_stdio(0);cin.tie(0);
//    #ifdef LOCAL
//        freopen(file".inp","r",stdin);
//        freopen(file".out","w",stdout);
//    #endif
//    int t = 1;
//    //cin >> t;
//    while(t--) travel_plan();
//}
/*
1.self check:
2.long long
3.size of array
4.code for testing
5.initializing
6.modulo number
*/
/**
  ∧__∧
(`•ω• )づ__∧
(つ  /( •ω•。)
  しーJ (nnノ) pat pat
**/
/**  /\_/\
*   (= ._.)
*   / >☕ \>💻
**/

Compilation message

crocodile.cpp:88:9: warning: "/*" within comment [-Wcomment]
   88 | /**  /\_/\
      |          
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:55:41: error: no matching function for call to 'std::vector<std::pair<long long int, int> >::push_back(<brace-enclosed initializer list>)'
   55 |         a[r[i][0]].pb({l[i], a[r[i][1]]});
      |                                         ^
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 crocodile.cpp:3:
/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<long long int, int>; _Alloc = std::allocator<std::pair<long long int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/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<long long int, int>; _Alloc = std::allocator<std::pair<long long int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, int> >::value_type&&' {aka 'std::pair<long long int, int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
crocodile.cpp:56:41: error: no matching function for call to 'std::vector<std::pair<long long int, int> >::push_back(<brace-enclosed initializer list>)'
   56 |         a[r[i][1]].pb({l[i], a[r[i][0]]});
      |                                         ^
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 crocodile.cpp:3:
/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<long long int, int>; _Alloc = std::allocator<std::pair<long long int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/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<long long int, int>; _Alloc = std::allocator<std::pair<long long int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<long long int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<long long int, int> >::value_type&&' {aka 'std::pair<long long int, int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~