답안 #415424

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
415424 2021-06-01T05:23:24 Z 조영욱(#7635) Road Construction (JOI21_road_construction) C++17
5 / 100
2169 ms 2097156 KB
#include <bits/stdc++.h>
using namespace std;

typedef pair<long long,long long> P;
P arr[250000];

int main(void) {
    int n,k;
    scanf("%d %d",&n,&k);
    for(int i=0;i<n;i++) {
        scanf("%lld %lld",&arr[i].first,&arr[i].second);
    }
    vector<long long> ret;
    for(int i=0;i<n;i++) {
        for(int j=i+1;j<n;j++) {
            ret.push_back(abs(arr[i].first-arr[j].first)+abs(arr[i].second-arr[j].second));
        }
    }
    sort(ret.begin(),ret.end());
    for(int i=0;i<k;i++) {
        printf("%lld\n",ret[i]);
    }
}

Compilation message

road_construction.cpp: In function 'int main()':
road_construction.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d %d",&n,&k);
      |     ~~~~~^~~~~~~~~~~~~~~
road_construction.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%lld %lld",&arr[i].first,&arr[i].second);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 6952 KB Output is correct
2 Correct 82 ms 6884 KB Output is correct
3 Correct 56 ms 5040 KB Output is correct
4 Correct 57 ms 5020 KB Output is correct
5 Correct 77 ms 5788 KB Output is correct
6 Correct 27 ms 4540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2109 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2169 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2169 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 6952 KB Output is correct
2 Correct 82 ms 6884 KB Output is correct
3 Correct 56 ms 5040 KB Output is correct
4 Correct 57 ms 5020 KB Output is correct
5 Correct 77 ms 5788 KB Output is correct
6 Correct 27 ms 4540 KB Output is correct
7 Runtime error 2070 ms 2097156 KB Execution killed with signal 9
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 6952 KB Output is correct
2 Correct 82 ms 6884 KB Output is correct
3 Correct 56 ms 5040 KB Output is correct
4 Correct 57 ms 5020 KB Output is correct
5 Correct 77 ms 5788 KB Output is correct
6 Correct 27 ms 4540 KB Output is correct
7 Runtime error 2109 ms 2097156 KB Execution killed with signal 9
8 Halted 0 ms 0 KB -