제출 #1158893

#제출 시각아이디문제언어결과실행 시간메모리
1158893PagodePaiva전선 연결 (IOI17_wiring)C++20
컴파일 에러
0 ms0 KiB
#include "wiring.h" #include<bits/stdc++.h> using namespace std; long long min_total_length(std::vector<int> r, std::vector<int> b) { long long ans = 0; reverse(r.begin(), r.end()) while(r.size() > b.size()){ ans += abs(r.back()-b[0]); r.pop_back(); } while(b.size() > r.size()){ ans += abs(b.back()-r[0]); b.pop_back(); } for(int i = 0;i < min((int)r.size(), (int)b.size());i++){ ans += b[i]-r[i]; } return ans; }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:8:32: error: expected ';' before 'while'
    8 |     reverse(r.begin(), r.end())
      |                                ^
      |                                ;
    9 |     while(r.size() > b.size()){
      |     ~~~~~