Submission #793525

#TimeUsernameProblemLanguageResultExecution timeMemory
793525fuad27Road Construction (JOI21_road_construction)C++17
5 / 100
10080 ms16964 KiB
#include<bits/stdc++.h> // #pragma GCC optimize("O3,unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") using namespace std; void solve() { int n, k; cin >> n >> k; int x[n], y[n]; multiset<unsigned int> s; for(int i = 0;i<n;i++) { cin >> x[i] >> y[i]; } for(int i = 0;i<n;i++) for(int j = i+1;j<n;j++){ s.insert((unsigned int)abs(x[i]-x[j])+abs(y[i]-y[j])); while(s.size()>k) { s.erase(--s.end()); } } for(auto it=s.begin();it!=s.end();it++)cout << *it << "\n"; } int main () { cin.tie(0)->sync_with_stdio(0); int t=1; while(t--)solve(); return 0; }

Compilation message (stderr)

road_construction.cpp: In function 'void solve()':
road_construction.cpp:17:21: warning: comparison of integer expressions of different signedness: 'std::multiset<unsigned int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |       while(s.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...