Submission #124609

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1246092019-07-03 15:00:46deinfreundSightseeing (NOI14_sightseeing)C++14
0 / 25
3604 ms97896 KiB
#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int>> > conns;
vector<int> ind;
vector<bool> needed;
vector<int> res;
int remaining;
void dijkstra(int node, int maxcost, int cost){
//cerr << "@" << node << " for " << cost << " until " << maxcost << endl;
if (needed[node]){
remaining --;
res[node] = cost;
}
if (remaining <= 0) return;
int i = ind[node];
for (;ind[node] < conns[node].size() && conns[node][ind[node]].first < maxcost;){
i = ind[node] ++;
dijkstra(conns[node][i].second, min(maxcost, (i < (conns[node].size() - 1)) ? conns[node][i + 1].first : 1000000000), max(conns[node][i].first, cost));
if (remaining <= 0) return;
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

sightseeing.cpp: In function 'void dijkstra(int, int, int)':
sightseeing.cpp:20:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (;ind[node] < conns[node].size() && conns[node][ind[node]].first < maxcost;){
sightseeing.cpp:22:53: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     dijkstra(conns[node][i].second, min(maxcost, (i < (conns[node].size() - 1)) ? conns[node][i + 1].first : 1000000000), max(conns[node][i].first, cost));
                                                   ~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...