Submission #361706

#TimeUsernameProblemLanguageResultExecution timeMemory
361706MoldovanAndrei1Wiring (IOI17_wiring)C++14
13 / 100
32 ms3820 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 += 1LL*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 -= 1LL*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...