제출 #767327

#제출 시각아이디문제언어결과실행 시간메모리
767327APROHACK전선 연결 (IOI17_wiring)C++14
컴파일 에러
0 ms0 KiB
#include "wiring.h" #include <bits/stdc++.h> #define pb push_back #define ff first #define ss second #define ll long long using namespace std; long long min_total_length(std::vector<int> r, std::vector<int> b) { int ir = r.size() -1 ; ib = 0; ll ans = 0; while(ir >= 0 and ib < b.size()){ ans += b[ib] - r[ir]; ir--; ib++; } while(ir >= 0){ ans += b[0] - r[ir]; ir--; } while(ib < b.size()){ ans += b[ib] - r.back(); ib++; } return ans; }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:10:25: error: 'ib' was not declared in this scope; did you mean 'ir'?
   10 |  int ir = r.size() -1 ; ib = 0;
      |                         ^~
      |                         ir