Submission #615539

# Submission time Handle Problem Language Result Execution time Memory
615539 2022-07-31T10:22:57 Z nohaxjustsoflo Crocodile's Underground City (IOI11_crocodile) C++17
0 / 100
9 ms 9940 KB
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> order_set;
mt19937 mt_rand(chrono::high_resolution_clock::now().time_since_epoch().count());
//uniform_int_distribution<int> gen; ///(min, max)
//int random() {return gen(mt_rand);}
const int mxN=2e5+5;
const int mod=998244353;
const int mxlogN=40;
const int mxK=26;
const int inf=2e9;
const int K=600;
struct edge
{
    int u,v,w;
    int other(int i)
    {
        return i^u^v;
    }
}es[mxN];
vector<int> adj[mxN];
int vis[mxN];
#include "crocodile.h"

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    for(int i=0; i<M; i++)
    {
        int u=R[i][0],v=R[i][1],w=L[i];
        es[i]={u,v,w};
        adj[u].push_back(i);
        adj[v].push_back(i);
    }
    priority_queue<pair<ll,int>> q;
    for(int i=0; i<K; i++) q.push({0,P[i]});
    while(q.size())
    {
        auto par=q.top(); q.pop();
        int i=par.second;
        ll w=-par.first;
        if(!vis[i])
        {
            vis[i]++;
            continue;
        }
        if(!i) return par.first;
        for(int e:adj[i])
        {
            int j=es[e].other(i);
            if(vis[i]==2) continue;
            ll d=w+es[e].w;
            q.push({-d,j});
        }
    }
}



/*
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);


}*/

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:41:34: warning: control reaches end of non-void function [-Wreturn-type]
   41 |     priority_queue<pair<ll,int>> q;
      |                                  ^
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 9940 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 9940 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 9940 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -