# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472514 | 2021-09-13T16:47:41 Z | ZaZo_ | Toll (BOI17_toll) | C++14 | 106 ms | 2148 KB |
#include <bits/stdc++.h> #define ZAZO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define int long long using namespace std; vector<pair<int,int>>edges[50001]; int k , n , m , o ; int dist[50001],vis[50001]={0}; void prepare() { for(int i = 0 ; i < n+1 ; i ++) dist[i]=INT_MAX; } void djk(int s , int e) { priority_queue<pair<int,int>>pq; dist[s]=0; pq.push({0,s}); while(!pq.empty()) { int c = -pq.top().first , u = pq.top().second; vis[u]=1; pq.pop(); for(int i = 0 ; i < edges[u].size() ; i++) { if(!vis[edges[u][i].first]&&dist[edges[u][i].first] > dist[u] + edges[u][i].second) { dist[edges[u][i].first] = dist[u] + edges[u][i].second; pq.push({-dist[edges[u][i].first],edges[u][i].first}); } } } } int32_t main() { ZAZO cin >> k >> n >> m >> o ; int pref[n]; for(int i = 0 ; i < n ; i ++) pref[i]=-1e15; for(int i = 0 ; i < m ; i ++) { int a , b , t; cin >> a >> b >> t; pref[b]=t; } for(int i = 1 ; i < n ; i++) { pref[i]+=pref[i-1]; } for(int i = 0 ; i < n ; i ++) { int a , b; cin>>a>>b; if(pref[b]-pref[a]<=0) cout<<"-1"<<endl; else cout<<pref[b]-pref[a]<<endl; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 106 ms | 2148 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 106 ms | 2004 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1484 KB | Output is correct |
2 | Incorrect | 1 ms | 1484 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 1484 KB | Output is correct |
2 | Incorrect | 1 ms | 1484 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 106 ms | 2148 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |