Submission #682427

# Submission time Handle Problem Language Result Execution time Memory
682427 2023-01-16T08:37:39 Z vjudge1 Road Construction (JOI21_road_construction) C++17
0 / 100
10000 ms 6100 KB
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define fr front()
using namespace std;
int main () {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n,k;
	cin>>n>>k;
	ll a[n],b[n];
	vector<ll> v(k);
	for(int i=0;i<k;i++){
	    v[i]=4000000000;
	}
	for(int i=0;i<n;i++){
	    cin>>a[i]>>b[i];
	}
	for(int i=0;i<n;i++){
	    for(int j=i+1;j<n;j++){
	        ll r=abs(a[i]-a[j])+abs(b[i]-b[j]);
	        if(r<v[k-1]){
	            v[k-1]=r;
	            sort(v.begin(),v.end());
	        }
	    }
	}
	for(int i=0;i<k;i++){
	    cout<<v[i]<<' ';
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 10093 ms 2260 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 10091 ms 6100 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 10066 ms 4180 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 10066 ms 4180 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 10093 ms 2260 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 10093 ms 2260 KB Time limit exceeded
2 Halted 0 ms 0 KB -