Submission #361704

#TimeUsernameProblemLanguageResultExecution timeMemory
361704MoldovanAndrei1Wiring (IOI17_wiring)C++14
0 / 100
24 ms2924 KiB
#include "wiring.h" long long min_total_length(std::vector<int> r, std::vector<int> b) { int n = r.size() , m = b . size(); long long sum = 0 ; if(n == m) { for(int i = 0 ; i < m ; i++) sum += b[i]; for(int i = 0 ; i < n ; i++) sum -= r[i]; return sum; } if(n > m ) { sum += b[0]*(n - m); for(int i = 0 ; i < m ;i++) sum += b[i]; for(int i = 0 ; i < n ; i++) sum -= r[i]; return sum; } if(m > n) { sum -= r[n-1]*(m - n); for(int i = 0 ; i < m ; i++) sum+=b[i]; for(int i = 0 ; i < n ; i++) sum-=r[i]; return sum; } }

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^
#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...