# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
284320 | 2020-08-27T08:35:35 Z | 문홍윤(#5761) | Aesthetic (NOI20_aesthetic) | C++17 | 2000 ms | 33752 KB |
#include <bits/stdc++.h> #define eb emplace_back #define mp make_pair #define F first #define S second #define all(x) x.begin(), x.end() #define svec(x) sort(x.begin(), x.end()) #define press(x) x.erase(unique(x.begin(), x.end()), x.end()) using namespace std; typedef long long LL; typedef pair<int, int> pii; typedef pair<LL, LL> pll; typedef pair<int, LL> pil; typedef pair<LL, int> pli; const LL llinf=2e18; const int inf=1e9; int n, m; pair<LL, pii> edg[300010]; LL ans; vector<pil> link[300010]; priority_queue<pli, vector<pli>, greater<pli> > pq; LL dis[300010]; LL dijk(){ for(int i=1; i<=n; i++){ dis[i]=llinf; link[i].clear(); } for(int i=1; i<=m; i++){ link[edg[i].S.F].eb(edg[i].S.S, edg[i].F); link[edg[i].S.S].eb(edg[i].S.F, edg[i].F); } pq.push(mp(0ll, 1)); while(pq.size()){ int nw=pq.top().S; LL d=pq.top().F; pq.pop(); if(dis[nw]<=d)continue; dis[nw]=d; for(auto i:link[nw])pq.push(mp(d+i.S, i.F)); } return dis[n]; } int main(){ scanf("%d %d", &n, &m); for(int i=1; i<=m; i++)scanf("%d %d %lld", &edg[i].S.F, &edg[i].S.S, &edg[i].F); LL maxx=edg[m].F; ans=dijk(); for(int i=m-1; i>=1; i--){ edg[i].F+=maxx; ans=max(ans, dijk()); edg[i].F-=maxx; maxx=max(maxx, edg[i].F); } printf("%lld", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 7424 KB | Output is correct |
2 | Correct | 6 ms | 7424 KB | Output is correct |
3 | Correct | 6 ms | 7424 KB | Output is correct |
4 | Correct | 7 ms | 7424 KB | Output is correct |
5 | Correct | 6 ms | 7424 KB | Output is correct |
6 | Correct | 6 ms | 7424 KB | Output is correct |
7 | Correct | 6 ms | 7424 KB | Output is correct |
8 | Correct | 6 ms | 7424 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 7424 KB | Output is correct |
2 | Correct | 6 ms | 7424 KB | Output is correct |
3 | Correct | 6 ms | 7424 KB | Output is correct |
4 | Correct | 7 ms | 7424 KB | Output is correct |
5 | Correct | 6 ms | 7424 KB | Output is correct |
6 | Correct | 6 ms | 7424 KB | Output is correct |
7 | Correct | 6 ms | 7424 KB | Output is correct |
8 | Correct | 6 ms | 7424 KB | Output is correct |
9 | Correct | 844 ms | 7612 KB | Output is correct |
10 | Correct | 858 ms | 7552 KB | Output is correct |
11 | Correct | 714 ms | 7564 KB | Output is correct |
12 | Correct | 731 ms | 7572 KB | Output is correct |
13 | Correct | 703 ms | 7596 KB | Output is correct |
14 | Correct | 716 ms | 7600 KB | Output is correct |
15 | Correct | 734 ms | 7600 KB | Output is correct |
16 | Correct | 718 ms | 7600 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2082 ms | 30484 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2091 ms | 30840 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2084 ms | 33752 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2084 ms | 33752 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 7424 KB | Output is correct |
2 | Correct | 6 ms | 7424 KB | Output is correct |
3 | Correct | 6 ms | 7424 KB | Output is correct |
4 | Correct | 7 ms | 7424 KB | Output is correct |
5 | Correct | 6 ms | 7424 KB | Output is correct |
6 | Correct | 6 ms | 7424 KB | Output is correct |
7 | Correct | 6 ms | 7424 KB | Output is correct |
8 | Correct | 6 ms | 7424 KB | Output is correct |
9 | Correct | 844 ms | 7612 KB | Output is correct |
10 | Correct | 858 ms | 7552 KB | Output is correct |
11 | Correct | 714 ms | 7564 KB | Output is correct |
12 | Correct | 731 ms | 7572 KB | Output is correct |
13 | Correct | 703 ms | 7596 KB | Output is correct |
14 | Correct | 716 ms | 7600 KB | Output is correct |
15 | Correct | 734 ms | 7600 KB | Output is correct |
16 | Correct | 718 ms | 7600 KB | Output is correct |
17 | Execution timed out | 2082 ms | 30484 KB | Time limit exceeded |
18 | Halted | 0 ms | 0 KB | - |