Submission #262147

#TimeUsernameProblemLanguageResultExecution timeMemory
262147youssefbou62Wiring (IOI17_wiring)C++14
Compilation error
0 ms0 KiB
#include "wiring.h" #include <bits/stdc++.h> #define sz(x) (int)x.size() using namespace std; const int MAXN = 205 ; bool taken[MAXN] ; long long min_total_length(std::vector<int> r, std::vector<int> b) { int R = sz(r) , B = sz(b) ; ll ans = 0 ; for(int i = 0 , j = 0 ; j < B && i < R ; i++ , j++ ){ ans += abs(r[i]-b[i]) ; } if(R>B){ for(int i = R-1 , c = 0 ; c < R-B ; c++ , i-- ){ ans += abs(r[i]-b[B-1]); } }else{ for(int i = B-1 , c = 0 ; c < B-R ; c++ , i-- ){ ans += abs(r[R-1]-b[i]); } } return ans; }

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:10:2: error: 'll' was not declared in this scope
   10 |  ll ans = 0 ;
      |  ^~
wiring.cpp:12:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |   ans += abs(r[i]-b[i]) ;
      |   ^~~
      |   abs
wiring.cpp:16:4: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |    ans += abs(r[i]-b[B-1]);
      |    ^~~
      |    abs
wiring.cpp:20:4: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |    ans += abs(r[R-1]-b[i]);
      |    ^~~
      |    abs
wiring.cpp:23:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |  return ans;
      |         ^~~
      |         abs