답안 #893348

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
893348 2023-12-27T03:04:49 Z vjudge1 Road Construction (JOI21_road_construction) C++17
5 / 100
161 ms 9544 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second

const long long INF = 1e18;
const int N = 1e5 + 1;

signed main(){
	
	int n;
	cin >> n;
	int k;
	cin >> k;
	int cnt = 0;
	int x[n],y[n];
	for(int i = 0;i < n;i++){
		cin >> x[i] >> y[i];
		if(y[i] == 0){
			cnt++;
		}
	}
	if(cnt == n){
		sort(x,x + n);
		vector<int> v;
		int j = 1,h = k;
		while(k > 0){
			for(int i = 0;i < n - j;i++){
				v.pb(x[i + j] - x[i]);
				k--;
			}
			j++;
		}
		k = h;
		sort(all(v));
		for(int i = 0;i < k;i++){
			cout << v[i] << "\n";	
		}
	} else if(n <= 1000){
		vector<int> v;
		for(int i = 0;i < n;i++){
			for(int j = i + 1;j < n;j++){
				v.pb(abs(x[i] - x[j]) + abs(y[i] - y[j]));
			}
		}
		sort(all(v));
		for(int i = 0;i < k;i++){
			cout << v[i] << "\n";
		}
	} else if(k == 1){
		
	} else if(k <= 10){
		
	} else {
		
	}
		
}
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 6836 KB Output is correct
2 Correct 54 ms 7048 KB Output is correct
3 Correct 35 ms 5056 KB Output is correct
4 Correct 35 ms 5056 KB Output is correct
5 Correct 50 ms 5772 KB Output is correct
6 Correct 19 ms 4556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 161 ms 9544 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 154 ms 4184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 154 ms 4184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 6836 KB Output is correct
2 Correct 54 ms 7048 KB Output is correct
3 Correct 35 ms 5056 KB Output is correct
4 Correct 35 ms 5056 KB Output is correct
5 Correct 50 ms 5772 KB Output is correct
6 Correct 19 ms 4556 KB Output is correct
7 Incorrect 57 ms 1884 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 6836 KB Output is correct
2 Correct 54 ms 7048 KB Output is correct
3 Correct 35 ms 5056 KB Output is correct
4 Correct 35 ms 5056 KB Output is correct
5 Correct 50 ms 5772 KB Output is correct
6 Correct 19 ms 4556 KB Output is correct
7 Incorrect 161 ms 9544 KB Output isn't correct
8 Halted 0 ms 0 KB -