답안 #793527

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
793527 2023-07-25T23:36:12 Z fuad27 Road Construction (JOI21_road_construction) C++17
5 / 100
10000 ms 5060 KB
#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];
  priority_queue<unsigned int> pq;
  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++){
      pq.push((unsigned int)abs(x[i]-x[j])+abs(y[i]-y[j]));
      while(pq.size()>k) {
        pq.pop();
      }
    }
  vector<unsigned int> v;
  while(pq.size()){
    v.push_back(pq.top());
    pq.pop();
  }
  for(int i=v.size()-1;i>=0;i--)cout << v[i] << "\n";
}
int main () {
  cin.tie(0)->sync_with_stdio(0);
  int t=1;
  while(t--)solve();
  return 0;
}

Compilation message

road_construction.cpp: In function 'void solve()':
road_construction.cpp:17:22: warning: comparison of integer expressions of different signedness: 'std::priority_queue<unsigned int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |       while(pq.size()>k) {
      |             ~~~~~~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 4952 KB Output is correct
2 Correct 73 ms 4892 KB Output is correct
3 Correct 47 ms 4996 KB Output is correct
4 Correct 47 ms 5060 KB Output is correct
5 Correct 68 ms 3876 KB Output is correct
6 Correct 15 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 10102 ms 3416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 10071 ms 2260 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 10071 ms 2260 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 4952 KB Output is correct
2 Correct 73 ms 4892 KB Output is correct
3 Correct 47 ms 4996 KB Output is correct
4 Correct 47 ms 5060 KB Output is correct
5 Correct 68 ms 3876 KB Output is correct
6 Correct 15 ms 340 KB Output is correct
7 Execution timed out 10034 ms 2248 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 4952 KB Output is correct
2 Correct 73 ms 4892 KB Output is correct
3 Correct 47 ms 4996 KB Output is correct
4 Correct 47 ms 5060 KB Output is correct
5 Correct 68 ms 3876 KB Output is correct
6 Correct 15 ms 340 KB Output is correct
7 Execution timed out 10102 ms 3416 KB Time limit exceeded
8 Halted 0 ms 0 KB -