Submission #713669

# Submission time Handle Problem Language Result Execution time Memory
713669 2023-03-22T19:21:37 Z MarwenElarbi Crocodile's Underground City (IOI11_crocodile) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define vi vector<int>
#define ve vector
#define ll long long
#define vl vector<ll>
#define vll vector<pair<ll,ll>>
#define onbit __builtin_popcount
#define ii pair<int,int>
#define vvi vector<vi>
#define vii vector<ii>
#define gii greater<ii>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF 1e18
#define eps 1e-7
#define eps1 1e-2
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX_A 1e5+5
using namespace std;
using namespace __gnu_pbds;
template <class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int MOD = 1e9+7;
const int nax = 1e5+5;
const int MAX_VAL = 1e9;
double PI=3.14159265359;
int arx[8]={1,1,0,-1,-1,-1, 0, 1};
int ary[8]={0,1,1, 1, 0,-1,-1,-1};
typedef complex<int> Point;
#define X real()
#define Y imag()
/*void setIO(string s) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}*/
vector<pair<int,int>> adj[nax];
vector<int> dis(nax);
int dp[nax];
vector<bool> tab(nax);
bool vis[nax];
signed travel_plan(signed n, signed m, signed R[][2], signed L[], signed k, signed P[]){
    int n = N;
    vi bahma(K);
    vl a(n,1e15);
    vl b(n,1e15);
    memset(dp,-1,sizeof dp);
    for(int i = 0; i < M; i++) {
        int x = R[i][0];
        int y = R[i][1];
        int t = L[i];
        adj[x].pb({y, t});
        adj[y].pb({x, t});
    }
    priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<>> pq;
    for (int i = 0; i < K; ++i)
    {
        pq.push({0,L[i]});
    }
    while(!pq.empty())
    {
        ll x=pq.top().fi;
        int y=pq.top().se;
        pq.pop();
        if (y==0)
        {
            return x;
        }
        if (vis[y]) continue;
        vis[y]=true;
        for(auto u:adj[y])
        {
            int node=u.fi;
            int d=u.se;
            if (a[node]>d+x){
                b[node]=a[node];
                a[node]=d+x;
            }else if(b[node]>d+x){
                b[node]=d+x;
            }
            pq.push({b[node],node});
        }
    }
}
/*int main(){
    optimise;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    //setIO("pump");
   
}*/

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:45:9: error: declaration of 'int n' shadows a parameter
   45 |     int n = N;
      |         ^
crocodile.cpp:44:27: note: 'int n' previously declared here
   44 | signed travel_plan(signed n, signed m, signed R[][2], signed L[], signed k, signed P[]){
      |                    ~~~~~~~^
crocodile.cpp:45:13: error: 'N' was not declared in this scope
   45 |     int n = N;
      |             ^
crocodile.cpp:46:14: error: 'K' was not declared in this scope
   46 |     vi bahma(K);
      |              ^
crocodile.cpp:50:24: error: 'M' was not declared in this scope
   50 |     for(int i = 0; i < M; i++) {
      |                        ^