Submission #992345

# Submission time Handle Problem Language Result Execution time Memory
992345 2024-06-04T09:47:37 Z Kalata_56 Road Construction (JOI21_road_construction) C++14
5 / 100
10000 ms 2097152 KB
#include<bits/stdc++.h>
using namespace std;
pair<long long,long long> kor[250001];
vector<long long> kol;
int main(){
    long long N,K;
    cin>>N>>K;
    for(long long i=0;i<N;i++){
        cin>>kor[i].first>>kor[i].second;
    }
    sort(kor,kor+N);
    for(int k=1;k<N;k++){
        for(long long i=k;i<N;i++){
            long long raz=abs(kor[i].first-kor[i-k].first)+abs(kor[i].second-kor[i-k].second);
            kol.push_back(raz);
        }
        if(kol.size()>=K && k>=1000){
            break;
        }
    }
    sort(kol.begin(),kol.end());
    for(long long i=0;i<K;i++){
        cout<<kol[i]<<endl;
    }
    return 0;
}

Compilation message

road_construction.cpp: In function 'int main()':
road_construction.cpp:17:22: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   17 |         if(kol.size()>=K && k>=1000){
      |            ~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 305 ms 7096 KB Output is correct
2 Correct 295 ms 7060 KB Output is correct
3 Correct 305 ms 4956 KB Output is correct
4 Correct 277 ms 5104 KB Output is correct
5 Correct 288 ms 5840 KB Output is correct
6 Correct 14 ms 5320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1388 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1549 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1549 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 305 ms 7096 KB Output is correct
2 Correct 295 ms 7060 KB Output is correct
3 Correct 305 ms 4956 KB Output is correct
4 Correct 277 ms 5104 KB Output is correct
5 Correct 288 ms 5840 KB Output is correct
6 Correct 14 ms 5320 KB Output is correct
7 Execution timed out 10082 ms 1055396 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 305 ms 7096 KB Output is correct
2 Correct 295 ms 7060 KB Output is correct
3 Correct 305 ms 4956 KB Output is correct
4 Correct 277 ms 5104 KB Output is correct
5 Correct 288 ms 5840 KB Output is correct
6 Correct 14 ms 5320 KB Output is correct
7 Runtime error 1388 ms 2097152 KB Execution killed with signal 9
8 Halted 0 ms 0 KB -