Submission #589975

#TimeUsernameProblemLanguageResultExecution timeMemory
589975AlesL0Wiring (IOI17_wiring)C++17
13 / 100
34 ms3768 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9+1; long long min_total_length(std::vector<int> r, std::vector<int> b){ ll s = 0; int mr = 0, mb = INF; for (int i = 0; i < b.size(); i++){ s += b[i]; mb = min(mb, b[i]); } for (int i = 0; i < r.size(); i++){ s -= r[i]; mr = max(mr, r[i]); } ll n = r.size(), m = b.size(); if (n > m)s += (n-m)*mb; else s -= (m-n)*mr; return s; }

Compilation message (stderr)

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