Submission #17008

# Submission time Handle Problem Language Result Execution time Memory
17008 2015-11-03T18:11:11 Z murat Crocodile's Underground City (IOI11_crocodile) C++
46 / 100
491 ms 161916 KB
#include "crocodile.h"
#include <bits/stdc++.h>

using namespace std;

#define dbgs(x) cerr << (#x) << " --> " << (x) << ' '
#define dbg(x) cerr << (#x) << " --> " << (x) << endl

#define foreach(i,x) for(type(x)i=x.begin();i!=x.end();i++)
#define FOR(ii,aa,bb) for(int ii=aa;ii<=bb;ii++)
#define ROF(ii,aa,bb) for(int ii=aa;ii>=bb;ii--)

#define type(x) __typeof(x.begin())

#define orta (bas + son >> 1)
#define sag (k + k + 1)
#define sol (k + k)

#define pb push_back
#define mp make_pair

#define nd second
#define st first

#define endl '\n'

typedef pair < int ,int > pii;

typedef long long ll;

const long long linf = 1e18+5;
const int mod = (int) 1e9 + 7;
const int logN = 17;
const int inf = 1e9;
const int N = 2e5 + 5;

int h[N], n, m, x, y, z;
vector< pii > v[N];

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
    n = N;
    m = M;
    FOR(i, 0, m-1) {
        int x = ++R[i][0],
            y = ++R[i][1];
        v[x].pb(mp(y, L[i]));
        v[y].pb(mp(x, L[i]));
    }

    priority_queue< pii , vector< pii >, greater< pii > > q;

    FOR(i, 0, K-1)
        q.push(mp(0, ++P[i]));

    while(!q.empty()) {
        int node = q.top().nd,
            cost = q.top().st;
        q.pop();
        if(++h[node] != 2 && cost) continue;
        if(node == 1) return cost;
        foreach(it, v[node])
            if(h[it->st] < 2)
                q.push(mp(it->nd + cost, it->st));
    }

    return -1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 124572 KB Output is correct
2 Correct 0 ms 124572 KB Output is correct
3 Correct 0 ms 124572 KB Output is correct
4 Correct 0 ms 124572 KB Output is correct
5 Correct 3 ms 124572 KB Output is correct
6 Correct 0 ms 124572 KB Output is correct
7 Correct 0 ms 124572 KB Output is correct
8 Correct 0 ms 124572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 124832 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 491 ms 161916 KB Output isn't correct
2 Halted 0 ms 0 KB -