Submission #946027

# Submission time Handle Problem Language Result Execution time Memory
946027 2024-03-14T09:43:03 Z yhkhoo Road Construction (JOI21_road_construction) C++17
5 / 100
51 ms 8536 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

typedef pair<int, int> pii;
#define fi first
#define se second

signed main(){
	cin.tie(0); ios_base::sync_with_stdio(0);
	int n, k;
	cin >> n >> k;
	vector<int> x(n), y(n);
	for(int i=0; i<n; i++){
		cin >> x[i] >> y[i];
	}
	vector<int> cost;
	cost.reserve(n*(n-1)/2);
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			cost.push_back(abs(x[i]-x[j]) + abs(y[i]-y[j]));
			// cout << i << ' ' << j << ':' << ' ' << cost.back() << '\n';
		}
	}
	sort(cost.begin(), cost.end());
	for(int i=0; i<k; i++){
		cout << cost[i] << '\n';
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 50 ms 6736 KB Output is correct
2 Correct 51 ms 6996 KB Output is correct
3 Correct 31 ms 4944 KB Output is correct
4 Correct 32 ms 4944 KB Output is correct
5 Correct 47 ms 5664 KB Output is correct
6 Correct 16 ms 4188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 34 ms 8536 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 49 ms 8532 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 49 ms 8532 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 50 ms 6736 KB Output is correct
2 Correct 51 ms 6996 KB Output is correct
3 Correct 31 ms 4944 KB Output is correct
4 Correct 32 ms 4944 KB Output is correct
5 Correct 47 ms 5664 KB Output is correct
6 Correct 16 ms 4188 KB Output is correct
7 Runtime error 19 ms 3932 KB Execution killed with signal 6
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 50 ms 6736 KB Output is correct
2 Correct 51 ms 6996 KB Output is correct
3 Correct 31 ms 4944 KB Output is correct
4 Correct 32 ms 4944 KB Output is correct
5 Correct 47 ms 5664 KB Output is correct
6 Correct 16 ms 4188 KB Output is correct
7 Runtime error 34 ms 8536 KB Execution killed with signal 6
8 Halted 0 ms 0 KB -