Submission #931129

# Submission time Handle Problem Language Result Execution time Memory
931129 2024-02-21T09:50:26 Z PieArmy Crocodile's Underground City (IOI11_crocodile) C++17
0 / 100
1 ms 4444 KB
#include "crocodile.h"
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
  vector<ll>komsu[N],cos[N];
  for(int i=0;i<M;i++){
    komsu[R[i][0]].pb(R[i][1]);
    komsu[R[i][1]].pb(R[i][0]);
    cos[R[i][0]].pb(L[i]);
    cos[R[i][1]].pb(L[i]);
  }
  priority_queue<pair<ll,int>>pq;
  int say[N];for(int &x:say)x=0;
  for(int i=0;i<K;i++){
    say[P[i]]=1;
    pq.push({0,P[i]});
  }
  while(pq.size()){
    ll sum=pq.top().first;
    int pos=pq.top().second;
    pq.pop();
    if(say[pos]==2)continue;
    say[pos]++;
    if(say[pos]==1)continue;
    if(!pos){
      return sum;
    }
    for(int i=0;i<komsu[pos].size();i++){
      pq.push({sum+cos[pos][i],komsu[pos][i]});
    }
  }
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:31:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(int i=0;i<komsu[pos].size();i++){
      |                 ~^~~~~~~~~~~~~~~~~~
crocodile.cpp:35:1: warning: control reaches end of non-void function [-Wreturn-type]
   35 | }
      | ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -