Submission #596717

# Submission time Handle Problem Language Result Execution time Memory
596717 2022-07-15T01:58:06 Z Temmie Sky Walking (IOI19_walk) C++17
33 / 100
184 ms 20044 KB
#include <bits/stdc++.h>

long long min_distance(std::vector <int> a, std::vector <int> h,
std::vector <int> l, std::vector <int> r, std::vector <int> y,
int s, int e) {
	if (e < s) {
		std::swap(s, e);
	}
	int n = a.size();
	int m = y.size();
	std::vector <std::vector <std::pair <int, bool>>> inds(n + 1);
	for (int i = 0; i < m; i++) {
		inds[l[i]].emplace_back(y[i], true);
		inds[r[i] + 1].emplace_back(y[i], false);
	}
	inds[1].emplace_back(0, false);
	std::map <int, long long> mp;
	mp[0] = 0;
	std::set <int> st;
	for (int i = 0; i < n; i++) {
		for (auto p : inds[i]) {
			if (!p.second && !st.count(p.first)) {
				mp.erase(p.first);
			}
		}
		st.clear();
		for (auto p : inds[i]) {
			if (p.second) {
				auto it = mp.lower_bound(p.first);
				long long val = 1LL << 60;
				if (it != mp.end()) {
					val = std::min(val, it->second - p.first + it->first);
				}
				if (it != mp.begin()) {
					it--;
					val = std::min(val, it->second - it->first + p.first);
				}
				if (val != (1LL << 60)) {
					mp[p.first] = val;
					st.insert(p.first);
				}
			}
		}
	}
	if (mp.empty()) {
		return -1;
	}
	return mp.begin()->first + mp.begin()->second + a[n - 1] - a[0];
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 3284 KB Output is correct
2 Correct 97 ms 5236 KB Output is correct
3 Correct 90 ms 5836 KB Output is correct
4 Correct 114 ms 10316 KB Output is correct
5 Correct 151 ms 16072 KB Output is correct
6 Correct 146 ms 12744 KB Output is correct
7 Correct 68 ms 7708 KB Output is correct
8 Correct 72 ms 9660 KB Output is correct
9 Correct 122 ms 13204 KB Output is correct
10 Correct 98 ms 13132 KB Output is correct
11 Correct 14 ms 2240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 3284 KB Output is correct
2 Correct 97 ms 5236 KB Output is correct
3 Correct 90 ms 5836 KB Output is correct
4 Correct 114 ms 10316 KB Output is correct
5 Correct 151 ms 16072 KB Output is correct
6 Correct 146 ms 12744 KB Output is correct
7 Correct 68 ms 7708 KB Output is correct
8 Correct 72 ms 9660 KB Output is correct
9 Correct 122 ms 13204 KB Output is correct
10 Correct 98 ms 13132 KB Output is correct
11 Correct 14 ms 2240 KB Output is correct
12 Correct 105 ms 5836 KB Output is correct
13 Correct 91 ms 9940 KB Output is correct
14 Correct 154 ms 20044 KB Output is correct
15 Correct 97 ms 14892 KB Output is correct
16 Correct 96 ms 15052 KB Output is correct
17 Correct 113 ms 15176 KB Output is correct
18 Correct 111 ms 14860 KB Output is correct
19 Correct 96 ms 15008 KB Output is correct
20 Correct 68 ms 10700 KB Output is correct
21 Correct 24 ms 6192 KB Output is correct
22 Correct 95 ms 12832 KB Output is correct
23 Correct 107 ms 13100 KB Output is correct
24 Correct 83 ms 14256 KB Output is correct
25 Correct 82 ms 12808 KB Output is correct
26 Correct 92 ms 16172 KB Output is correct
27 Correct 184 ms 19164 KB Output is correct
28 Correct 69 ms 13992 KB Output is correct
29 Correct 144 ms 16680 KB Output is correct
30 Correct 86 ms 10668 KB Output is correct
31 Correct 137 ms 17204 KB Output is correct
32 Correct 83 ms 13888 KB Output is correct
33 Correct 80 ms 14764 KB Output is correct
34 Correct 110 ms 14752 KB Output is correct
35 Correct 91 ms 12936 KB Output is correct
36 Correct 85 ms 12492 KB Output is correct
37 Correct 84 ms 11132 KB Output is correct
38 Correct 93 ms 12732 KB Output is correct
39 Correct 102 ms 16060 KB Output is correct
40 Correct 93 ms 12804 KB Output is correct
41 Correct 68 ms 11836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -