Submission #413629

#TimeUsernameProblemLanguageResultExecution timeMemory
413629GK2007Road Construction (JOI21_road_construction)C++14
0 / 100
2268 ms2097156 KiB
#include<algorithm> #include<iostream> #include<vector> using namespace std; int main(){ int n,m,i,j; cin>>n>>m; pair<int, int> a[n+1]; vector<int> b; for(i=1; i<=n; i++) { cin>>a[i].first>>a[i].second; } for(j=1; j<n; j++) { for(i=j+1; i<=n; i++) { b.push_back(abs(a[i].first-a[i].second)+abs(a[j].first-a[j].second)); } } sort(b.begin(), b.end()); for(i=0; i<m; i++) { cout<<b[i]<<endl; } return 0; }
#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...