제출 #1060905

#제출 시각아이디문제언어결과실행 시간메모리
1060905vjudge1Wiring (IOI17_wiring)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll min_total_length(int r[], int b[]) { ll ans = 0; int n = sizeof(r) / sizeof(r[0]), m = sizeof(b) / sizeof(b[0]); ll dp[n][m], inf = 1e18; for(int i = 0; i <= n; i ++) for(int j = 0; j <= m; j ++) dp[i][j] = inf; dp[0][0] = 0; for(int i = 0; i < n; i ++) for(int j = 0; j < m; j ++) dp[i + 1][j + 1] = abs(r[i] - b[j]) + min(min(dp[i][j - 1], dp[i - 1][j]), dp[i - 1][j - 1]); ans = dp[n][m]; return ans; }

컴파일 시 표준 에러 (stderr) 메시지

wiring.cpp: In function 'll min_total_length(int*, int*)':
wiring.cpp:10:18: warning: 'sizeof' on array function parameter 'r' will return size of 'int*' [-Wsizeof-array-argument]
   10 |   int n = sizeof(r) / sizeof(r[0]), m = sizeof(b) / sizeof(b[0]);
      |                 ~^~
wiring.cpp:7:25: note: declared here
    7 | ll min_total_length(int r[], int b[])
      |                     ~~~~^~~
wiring.cpp:10:48: warning: 'sizeof' on array function parameter 'b' will return size of 'int*' [-Wsizeof-array-argument]
   10 |   int n = sizeof(r) / sizeof(r[0]), m = sizeof(b) / sizeof(b[0]);
      |                                               ~^~
wiring.cpp:7:34: note: declared here
    7 | ll min_total_length(int r[], int b[])
      |                              ~~~~^~~
wiring.cpp:16:14: warning: array subscript 2 is above array bounds of 'll [(<anonymous> + 1)]' {aka 'long long int [(<anonymous> + 1)]'} [-Warray-bounds]
   16 |       dp[i][j] = inf;
      |       ~~~~~~~^
wiring.cpp:12:6: note: while referencing 'dp.6'
   12 |   ll dp[n][m], inf = 1e18;
      |      ^~
wiring.cpp:16:14: warning: array subscript 1 is outside array bounds of 'll [(<anonymous> + 1)]' {aka 'long long int [(<anonymous> + 1)]'} [-Warray-bounds]
   16 |       dp[i][j] = inf;
      |       ~~~~~~~^
wiring.cpp:12:6: note: while referencing 'dp.6'
   12 |   ll dp[n][m], inf = 1e18;
      |      ^~
wiring.cpp:16:11: warning: array subscript 2 is above array bounds of 'll [(<anonymous> + 1)][(<anonymous> + 1)]' {aka 'long long int [(<anonymous> + 1)][(<anonymous> + 1)]'} [-Warray-bounds]
   16 |       dp[i][j] = inf;
      |       ~~~~^
wiring.cpp:12:6: note: while referencing 'dp.6'
   12 |   ll dp[n][m], inf = 1e18;
      |      ^~
wiring.cpp:16:14: warning: array subscript 2 is outside array bounds of 'll [(<anonymous> + 1)]' {aka 'long long int [(<anonymous> + 1)]'} [-Warray-bounds]
   16 |       dp[i][j] = inf;
      |       ~~~~~~~^
wiring.cpp:12:6: note: while referencing 'dp.6'
   12 |   ll dp[n][m], inf = 1e18;
      |      ^~
wiring.cpp:16:11: warning: array subscript 2 is above array bounds of 'll [(<anonymous> + 1)][(<anonymous> + 1)]' {aka 'long long int [(<anonymous> + 1)][(<anonymous> + 1)]'} [-Warray-bounds]
   16 |       dp[i][j] = inf;
      |       ~~~~^
wiring.cpp:12:6: note: while referencing 'dp.6'
   12 |   ll dp[n][m], inf = 1e18;
      |      ^~
/usr/bin/ld: /tmp/cccw9LbY.o: in function `main':
grader.cpp:(.text.startup+0x23a): undefined reference to `min_total_length(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status