Submission #62822

# Submission time Handle Problem Language Result Execution time Memory
62822 2018-07-30T10:30:06 Z Bodo171 Crocodile's Underground City (IOI11_crocodile) C++14
100 / 100
1586 ms 85256 KB
#include "crocodile.h"
#include <vector>
#include <queue>
#include <climits>
#include <iostream>
using namespace std;
const int nmax=100005;
vector< pair<int,long long> > v[nmax];
long long d[nmax];
priority_queue< pair<long long,int> > pq;
int i,s,nod,E[nmax];
long long cost,di;
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
  for(i=0;i<M;i++)
  {
     v[R[i][0]].push_back({R[i][1],L[i]});
     v[R[i][1]].push_back({R[i][0],L[i]});
  }
  for(i=0;i<N;i++)
    d[i]=LLONG_MAX;
  for(i=0;i<K;i++)
  {
      d[P[i]]=0;
      pq.push({-d[P[i]],P[i]});
      E[P[i]]=1;
  }
  while(!pq.empty())
  {
      cost=-pq.top().first;
      s=pq.top().second;pq.pop();
      E[s]++;
      if(E[s]!=2) continue;
      d[s]=cost;
      for(i=0;i<v[s].size();i++)
      {
          nod=v[s][i].first;di=d[s]+v[s][i].second;
          if(E[nod]<2)
            pq.push({-di,nod});
      }
  }
  return d[0];
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:35:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(i=0;i<v[s].size();i++)
               ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 6 ms 2788 KB Output is correct
3 Correct 6 ms 2788 KB Output is correct
4 Correct 6 ms 2884 KB Output is correct
5 Correct 7 ms 2884 KB Output is correct
6 Correct 6 ms 3052 KB Output is correct
7 Correct 6 ms 3052 KB Output is correct
8 Correct 6 ms 3052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 6 ms 2788 KB Output is correct
3 Correct 6 ms 2788 KB Output is correct
4 Correct 6 ms 2884 KB Output is correct
5 Correct 7 ms 2884 KB Output is correct
6 Correct 6 ms 3052 KB Output is correct
7 Correct 6 ms 3052 KB Output is correct
8 Correct 6 ms 3052 KB Output is correct
9 Correct 8 ms 3332 KB Output is correct
10 Correct 5 ms 3332 KB Output is correct
11 Correct 7 ms 3332 KB Output is correct
12 Correct 11 ms 3764 KB Output is correct
13 Correct 10 ms 4024 KB Output is correct
14 Correct 4 ms 4024 KB Output is correct
15 Correct 6 ms 4024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 6 ms 2788 KB Output is correct
3 Correct 6 ms 2788 KB Output is correct
4 Correct 6 ms 2884 KB Output is correct
5 Correct 7 ms 2884 KB Output is correct
6 Correct 6 ms 3052 KB Output is correct
7 Correct 6 ms 3052 KB Output is correct
8 Correct 6 ms 3052 KB Output is correct
9 Correct 8 ms 3332 KB Output is correct
10 Correct 5 ms 3332 KB Output is correct
11 Correct 7 ms 3332 KB Output is correct
12 Correct 11 ms 3764 KB Output is correct
13 Correct 10 ms 4024 KB Output is correct
14 Correct 4 ms 4024 KB Output is correct
15 Correct 6 ms 4024 KB Output is correct
16 Correct 1215 ms 80996 KB Output is correct
17 Correct 179 ms 80996 KB Output is correct
18 Correct 174 ms 80996 KB Output is correct
19 Correct 1586 ms 85256 KB Output is correct
20 Correct 638 ms 85256 KB Output is correct
21 Correct 60 ms 85256 KB Output is correct
22 Correct 686 ms 85256 KB Output is correct