답안 #415423

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
415423 2021-06-01T05:22:20 Z 조영욱(#7635) Road Construction (JOI21_road_construction) C++17
0 / 100
2237 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("%d %d",&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:11:17: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   11 |         scanf("%d %d",&arr[i].first,&arr[i].second);
      |                ~^     ~~~~~~~~~~~~~
      |                 |     |
      |                 int*  long long int*
      |                %lld
road_construction.cpp:11:20: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
   11 |         scanf("%d %d",&arr[i].first,&arr[i].second);
      |                   ~^                ~~~~~~~~~~~~~~
      |                    |                |
      |                    int*             long long int*
      |                   %lld
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("%d %d",&arr[i].first,&arr[i].second);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 83 ms 6928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2237 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2194 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2194 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 83 ms 6928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 83 ms 6928 KB Output isn't correct
2 Halted 0 ms 0 KB -