제출 #337118

#제출 시각아이디문제언어결과실행 시간메모리
337118pggp전선 연결 (IOI17_wiring)C++14
13 / 100
48 ms3948 KiB
#include <bits/stdc++.h> #include "wiring.h" using namespace std; long long min_total_length(vector < int > r, vector < int > b){ long long last_r = r[r.size() - 1]; long long first_b = b[0]; long long ans = 0; for(long long i = 0; i < min(r.size(), b.size()); i++){ ans += (long long)(b[i] - r[i]); if(i == r.size() - 1){ // łączę wszystkie niebieksie do ostatniego r for (long long j = i + 1; j < b.size(); ++j) { ans += (long long)b[j] - last_r; } return ans; } if(i == b.size() - 1){ // łączę wszystkie czerwone do pierwszego b for (long long j = i + 1; j < r.size(); ++j) { ans += first_b - (long long)r[j]; } return ans; } } return ans; }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:10:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'const long unsigned int' [-Wsign-compare]
   10 |  for(long long i = 0; i < min(r.size(), b.size()); i++){
      |                       ~~^~~~~~~~~~~~~~~~~~~~~~~~~
wiring.cpp:12:8: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |   if(i == r.size() - 1){
      |      ~~^~~~~~~~~~~~~~~
wiring.cpp:14:32: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |    for (long long j = i + 1; j < b.size(); ++j)
      |                              ~~^~~~~~~~~~
wiring.cpp:20:8: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   if(i == b.size() - 1){
      |      ~~^~~~~~~~~~~~~~~
wiring.cpp:22:32: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |    for (long long j = i + 1; j < r.size(); ++j)
      |                              ~~^~~~~~~~~~
#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...