답안 #723948

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
723948 2023-04-14T13:55:35 Z LittleCube Sky Walking (IOI19_walk) C++17
33 / 100
172 ms 21628 KB
#pragma GCC optimize("Ofast")
#include "walk.h"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;

ll N, M, K, S, T;
multiset<pll> st;
vector<int> in[100005], out[100005];

ll min_distance(vector<int> x, vector<int> h, vector<int> l, vector<int> r, vector<int> y, int s, int g)
{
	N = x.size(), M = l.size();
	for (int i = 0; i < M; i++)
	{
		in[l[i]].emplace_back(y[i]);
		if (r[i] < N - 1)
			out[r[i]].emplace_back(y[i]);
	}
	out[0].emplace_back(0);
	st.insert(pll(0, 0));
	for (int i = 0; i < N; i++)
	{
		for (int j : in[i])
		{
			ll dis = 1e18;
			auto iter = st.lower_bound(pll(j, 0));
			if (iter != st.end())
				dis = min(dis, iter->S + abs(j - iter->F));
			if (iter != st.begin())
			{
				--iter;
				dis = min(dis, iter->S + abs(j - iter->F));
			}
			st.insert(pll(j, dis));
		}
		for (int j : out[i])
			st.erase(st.lower_bound(pll(j, 0)));
	}
	if(st.empty())
		return -1;
	ll ans = st.begin()->F + st.begin()->S + x[N - 1] - x[0];
	return (ans >= 1e18 ? -1 : ans);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 7280 KB Output is correct
2 Correct 75 ms 8780 KB Output is correct
3 Correct 88 ms 11456 KB Output is correct
4 Correct 126 ms 17100 KB Output is correct
5 Correct 172 ms 21628 KB Output is correct
6 Correct 140 ms 19352 KB Output is correct
7 Correct 66 ms 13644 KB Output is correct
8 Correct 111 ms 19176 KB Output is correct
9 Correct 149 ms 20864 KB Output is correct
10 Correct 95 ms 18880 KB Output is correct
11 Correct 13 ms 6552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 7280 KB Output is correct
2 Correct 75 ms 8780 KB Output is correct
3 Correct 88 ms 11456 KB Output is correct
4 Correct 126 ms 17100 KB Output is correct
5 Correct 172 ms 21628 KB Output is correct
6 Correct 140 ms 19352 KB Output is correct
7 Correct 66 ms 13644 KB Output is correct
8 Correct 111 ms 19176 KB Output is correct
9 Correct 149 ms 20864 KB Output is correct
10 Correct 95 ms 18880 KB Output is correct
11 Correct 13 ms 6552 KB Output is correct
12 Correct 86 ms 11492 KB Output is correct
13 Correct 135 ms 17048 KB Output is correct
14 Correct 152 ms 21588 KB Output is correct
15 Correct 99 ms 16924 KB Output is correct
16 Correct 107 ms 17292 KB Output is correct
17 Correct 114 ms 17164 KB Output is correct
18 Correct 98 ms 17040 KB Output is correct
19 Correct 99 ms 17244 KB Output is correct
20 Correct 83 ms 13552 KB Output is correct
21 Correct 35 ms 8592 KB Output is correct
22 Correct 84 ms 14896 KB Output is correct
23 Correct 89 ms 15124 KB Output is correct
24 Correct 122 ms 16636 KB Output is correct
25 Correct 90 ms 15180 KB Output is correct
26 Correct 100 ms 19144 KB Output is correct
27 Correct 161 ms 21248 KB Output is correct
28 Correct 106 ms 16912 KB Output is correct
29 Correct 144 ms 19368 KB Output is correct
30 Correct 66 ms 13600 KB Output is correct
31 Correct 153 ms 20760 KB Output is correct
32 Correct 102 ms 17464 KB Output is correct
33 Correct 93 ms 18580 KB Output is correct
34 Correct 121 ms 17740 KB Output is correct
35 Correct 96 ms 17036 KB Output is correct
36 Correct 83 ms 16660 KB Output is correct
37 Correct 71 ms 15904 KB Output is correct
38 Correct 87 ms 18400 KB Output is correct
39 Correct 102 ms 19604 KB Output is correct
40 Correct 77 ms 17696 KB Output is correct
41 Correct 92 ms 16288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -