Submission #284310

# Submission time Handle Problem Language Result Execution time Memory
284310 2020-08-27T08:21:22 Z 임성재(#5754) Aesthetic (NOI20_aesthetic) C++17
13 / 100
726 ms 62328 KB
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll, pll> plll;
const int inf = 1e9;
const ll INF = 1e18;

int n, m;
int u[300010];
int v[300010];
ll w[300010];
ll a[300010];
vector<pll> g[300010];

ll f(int k) {
	bool chk[2010] = {};
	priority_queue<pll, vector<pll>, greater<pll>> pQ;

	pQ.em(0, 1);

	while(pQ.size()) {
		ll d = pQ.top().fi;
		int x = pQ.top().se;

		pQ.pop();

		if(x == n) return d;
		if(chk[x]) continue;

		chk[x] = true;

		for(auto i : g[x]) {
			if(chk[i.fi] || i.se == k) continue;

			pQ.em(d + w[i.se], i.fi);
		}
	}

	return INF;
}

int main() {
	fast;

	cin >> n >> m;

	for(int i=1; i<=m; i++) {
		cin >> u[i] >> v[i] >> w[i];

		g[u[i]].eb(v[i], i);
		g[v[i]].eb(u[i], i);
	}

	for(int i=m; i > 1; i--) {
		a[i-1] = max(a[i], w[i]);
	}

	ll ans = 0;
	for(int i=1; i<=m; i++) {
		ans = max(ans, min(f(0) + a[i], f(i)));
	}

	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7424 KB Output is correct
2 Correct 5 ms 7424 KB Output is correct
3 Correct 6 ms 7424 KB Output is correct
4 Correct 6 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 5 ms 7424 KB Output is correct
2 Correct 5 ms 7424 KB Output is correct
3 Correct 6 ms 7424 KB Output is correct
4 Correct 6 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 726 ms 7696 KB Output is correct
10 Correct 692 ms 7656 KB Output is correct
11 Correct 531 ms 7672 KB Output is correct
12 Correct 582 ms 7640 KB Output is correct
13 Correct 550 ms 7716 KB Output is correct
14 Correct 573 ms 7672 KB Output is correct
15 Correct 574 ms 7552 KB Output is correct
16 Correct 554 ms 7652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 280 ms 61432 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 279 ms 62328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 275 ms 60984 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 275 ms 60984 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7424 KB Output is correct
2 Correct 5 ms 7424 KB Output is correct
3 Correct 6 ms 7424 KB Output is correct
4 Correct 6 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 726 ms 7696 KB Output is correct
10 Correct 692 ms 7656 KB Output is correct
11 Correct 531 ms 7672 KB Output is correct
12 Correct 582 ms 7640 KB Output is correct
13 Correct 550 ms 7716 KB Output is correct
14 Correct 573 ms 7672 KB Output is correct
15 Correct 574 ms 7552 KB Output is correct
16 Correct 554 ms 7652 KB Output is correct
17 Runtime error 280 ms 61432 KB Execution killed with signal 11
18 Halted 0 ms 0 KB -