답안 #1037049

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1037049 2024-07-28T00:02:42 Z HappyCapybara Sky Walking (IOI19_walk) C++17
10 / 100
4000 ms 1048576 KB
#include "walk.h"
#include<bits/stdc++.h>
using namespace std;

#define ll long long

ll min_distance(vector<int> x, vector<int> h, vector<int> l, vector<int> r, vector<int> y, int s, int g){
	int n = x.size(), m = l.size();
	vector<vector<int>> sws(n, vector<int>(1, m));
	for (int i=0; i<m; i++){
		for (int j=l[i]; j<=r[i]; j++){
			if (y[i] <= h[j]) sws[j].push_back(i);
		}
	}
	y.push_back(0);
	priority_queue<vector<ll>> pq;
	unordered_set<ll> seen;
	pq.push({0, s, m});
	while (!pq.empty()){
		ll d = -pq.top()[0];
		int bld = pq.top()[1], sw = pq.top()[2];
		pq.pop();
		//cout << d << " " << bld << " " << sw << "\n";
		if (bld == g && sw == m) return d;
		if (seen.find(bld*100001+sw) != seen.end()) continue;
		seen.insert(bld*100001+sw);
		for (int next : sws[bld]){
			if (next != sw) pq.push({-(d+abs(y[next]-y[sw])), bld, next});
		}
		if (sw == m) continue;
		for (int next=l[sw]; next<=r[sw]; next++){
			if (next != bld && h[next] >= y[sw]) pq.push({-(d+abs(x[next]-x[bld])), next, sw});
		}
	}
	return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 432 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 7 ms 1004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 432 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 62 ms 21368 KB Output is correct
4 Correct 1999 ms 55952 KB Output is correct
5 Correct 72 ms 15488 KB Output is correct
6 Correct 554 ms 14884 KB Output is correct
7 Correct 71 ms 15440 KB Output is correct
8 Execution timed out 4025 ms 241424 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 209 ms 8464 KB Output is correct
2 Runtime error 2035 ms 1048576 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 209 ms 8464 KB Output is correct
2 Runtime error 2035 ms 1048576 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 1 ms 604 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 432 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 7 ms 1004 KB Output is correct
18 Correct 0 ms 432 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 62 ms 21368 KB Output is correct
21 Correct 1999 ms 55952 KB Output is correct
22 Correct 72 ms 15488 KB Output is correct
23 Correct 554 ms 14884 KB Output is correct
24 Correct 71 ms 15440 KB Output is correct
25 Execution timed out 4025 ms 241424 KB Time limit exceeded
26 Halted 0 ms 0 KB -