Submission #992341

#TimeUsernameProblemLanguageResultExecution timeMemory
992341Kalata_56Road Construction (JOI21_road_construction)C++14
27 / 100
509 ms39088 KiB
#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; if(N>=1000){ 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>=10){ break; } } sort(kol.begin(),kol.end()); for(long long i=0;i<K;i++){ cout<<kol[i]<<endl; } }else{ for(long long i=0;i<N;i++){ cin>>kor[i].first>>kor[i].second; } for(long long i=0;i<N;i++){ for(long long j=i+1;j<N;j++){ long long raz=abs(kor[i].first-kor[j].first)+abs(kor[i].second-kor[j].second); kol.push_back(raz); } } sort(kol.begin(),kol.end()); for(long long i=0;i<K;i++){ cout<<kol[i]<<endl; } } return 0; }

Compilation message (stderr)

road_construction.cpp: In function 'int main()':
road_construction.cpp:18:26: 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]
   18 |             if(kol.size()>=K && k>=10){
      |                ~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...