제출 #774731

#제출 시각아이디문제언어결과실행 시간메모리
774731Tony1234전선 연결 (IOI17_wiring)C++17
13 / 100
27 ms3800 KiB
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define pb push_back #define vt vector #define vi vector<int> #define vll vector<ll> #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() #define ub upper_bound #define lb lower_bound const int inf = (int)2e9, mod = (int)1e9 + 7, mx = (int)2e5 + 10; const ll infll = (ll)7e18; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); long long min_total_length(std::vector<int> r, std::vector<int> b){ sort(r.begin(), r.end()); sort(b.begin(), b.end()); ll sum = 0; for(int i = 0; i < min(r.size(), b.size()); i++)sum += b[i] - r[i]; if(r.size() > b.size()){ for(int i = b.size(); i < r.size(); i++)sum += b[0] - r[i]; }else{ for(int i = r.size(); i < b.size(); i++)sum += b[i] - r.back(); } return sum; }

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

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