Submission #992350

#TimeUsernameProblemLanguageResultExecution timeMemory
992350Kalata_56Road Construction (JOI21_road_construction)C++14
59 / 100
10028 ms8744 KiB
#include<bits/stdc++.h> using namespace std; pair<long long,long long> kor[250001]; priority_queue<long long> kol; vector<long long> rez; int main(){ ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); 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(raz); if(kol.size()>K){ kol.pop(); } } if(k>=1000){ break; } } while(!kol.empty()){ rez.push_back(kol.top()); kol.pop(); } sort(rez.begin(),rez.end()); for(long long i=0;i<K;i++){ cout<<rez[i]<<endl; } return 0; }

Compilation message (stderr)

road_construction.cpp: In function 'int main()':
road_construction.cpp:20:26: warning: comparison of integer expressions of different signedness: 'std::priority_queue<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   20 |             if(kol.size()>K){
      |                ~~~~~~~~~~^~
#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...