제출 #589351

#제출 시각아이디문제언어결과실행 시간메모리
589351AlesL0전선 연결 (IOI17_wiring)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e10; long long min_total_length(std::vector<int> r, std::vector<int> b){ ll n = r.size(), m = b.size(); ll s = 0; int mr = 0, mb = INF; for(int i = 0; i < n; i++){s -= r[i]; mr = max(mr, r[i]);} for (int i = 0; i < m; i++){s += b[i]; mb = min(mb, b[i]);} if (n > m)s -= (n-m)*mr; else if (m > n)s += (m-n)*mb; return s; }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:12:22: warning: overflow in conversion from 'll' {aka 'long long int'} to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
   12 |     int mr = 0, mb = INF;
      |                      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...