Submission #26957

# Submission time Handle Problem Language Result Execution time Memory
26957 2017-07-07T12:51:05 Z repeating Crocodile's Underground City (IOI11_crocodile) C++11
0 / 100
823 ms 159740 KB
#include <bits/stdc++.h>
#include "crocodile.h"
#define F first
#define S second
#define P push
#define pb push_back
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define W while
#define R return
#define C continue
#define SI size()
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define pii pair<int,int>
#define SF(x) scanf("%I64d",&x)
#define SF2(x,y) scanf("%I64d%I64d",&x,&y)
#define SF3(x,y,z) scanf("%I64d%I64d%I64d",&x,&y,&z)
#define SF4(x,y,z,o) scanf("%I64d%I64d%I64d%I64d",&x,&y,&z,&o)
#define all(v) v.begin(),v.end()
using namespace std;
const long long INF = 1e9+5e8;
const int MX=100009;
int n,m,k;
int res[MX];
bool check[MX];
bool vis[MX];
vector<pii> adj[MX];
priority_queue< pii , vector<pii> , greater<pii> > pq;
int solve(){
    W(!pq.empty()){
        int ver=pq.top().S,dis=pq.top().F;
        pq.pop();
        if(vis[ver])C;
        cout<<ver<<" "<<dis<<endl;
        if(check[ver])vis[ver]=1;
        else{
            check[ver]=1;
            C;
        }
        res[ver]=dis;
        for(auto i : adj[ver]){
            pq.P({dis+i.S,i.F});
        }
    }
    R res[0];
}
int travel_plan(int N, int M, int r[][2], int L[], int K, int p[])
{
    n=N,m=M,k=K;
    for(int i=0;i<m;i++){
        adj[r[i][0]].pb({r[i][1],L[i]});
        adj[r[i][1]].pb({r[i][0],L[i]});
    }
    for(int i=0;i<k;i++){
        res[p[i]]=0;
        check[p[i]]=1;
        pq.P({0,p[i]});
    }
    return solve();
}


# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 122332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 122744 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 823 ms 159740 KB Execution timed out (wall clock limit exceeded)
2 Halted 0 ms 0 KB -