제출 #895459

#제출 시각아이디문제언어결과실행 시간메모리
895459nightfalWiring (IOI17_wiring)C++14
컴파일 에러
0 ms0 KiB
#include "wiring.h" #include <stdlib.h> #include <algorithm> using namespace std; bool isSubtask1(std::vector<int>, std::vector<int>); bool isSubtask2(std::vector<int>, std::vector<int>); long long subtask1(std::vector<int>, std::vector<int>); long long subtask2(std::vector<int>, std::vector<int>); long long min_total_length(std::vector<int> r, std::vector<int> b) { int n = r.size(), m = b.size(); if (isSubtask1(r,b)) return subtask1(r,b); else if (isSubtask2(r,b)) return subtask2(rkb); } bool isSubtask1(std::vector<int> r, std::vector<int> b) { if (r.size()<=200 && b.size()<=200) return true; else return false; } bool isSubtask2(std::vector<int> r, std::vector<int> b) { if (r[r.size()-1]<b[0]) return true; else return false; } long long subtask1(std::vector<int> r, std::vector<int> b) { int n = r.size(), m = b.size(); long long dp[n][m]; dp[0][0] = abs(r[0]-b[0]); for(int i=1; i<n; i++) dp[i][0] = dp[i-1][0] + abs(r[i]-b[0]); for(int j=1; j<m; j++) dp[0][j] = dp[0][j-1] + abs(r[0]-b[j]); for(int i=1; i<n; i++) for(int j=1; j<m; j++) dp[i][j] = min(min(dp[i-1][j],dp[i][j-1]),dp[i-1][j-1]) + abs(r[i]-b[j]); return dp[n-1][m-1]; } long long subtask2(std::vector<int> r, std::vector<int> b) { }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:14:46: error: 'rkb' was not declared in this scope
   14 |    else if (isSubtask2(r,b)) return subtask2(rkb);
      |                                              ^~~
wiring.cpp:12:8: warning: unused variable 'n' [-Wunused-variable]
   12 |    int n = r.size(), m = b.size();
      |        ^
wiring.cpp:12:22: warning: unused variable 'm' [-Wunused-variable]
   12 |    int n = r.size(), m = b.size();
      |                      ^
wiring.cpp: In function 'long long int subtask1(std::vector<int>, std::vector<int>)':
wiring.cpp:36:7: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   36 |       for(int j=1; j<m; j++)
      |       ^~~
wiring.cpp:38:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   38 |  return dp[n-1][m-1];
      |  ^~~~~~
wiring.cpp: In function 'long long int subtask2(std::vector<int>, std::vector<int>)':
wiring.cpp:42:1: warning: no return statement in function returning non-void [-Wreturn-type]
   42 | }
      | ^