Submission #629697

#TimeUsernameProblemLanguageResultExecution timeMemory
629697samedWiring (IOI17_wiring)C++17
Compilation error
0 ms0 KiB
#include "wiring.h" using namespace std; long long min_total_length(std::vector<int> r, std::vector<int> b) { long long answer = 0; if(n < m) { swap(a,b); swap(n,m); } int i = n-1,j=m-1; while(j >= 0) { answer += abs(a[i] - b[j]); i--; j--; } while(i >= 0) { answer += abs(a[i] - b[m-1]); i--; } return answer; }

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:6:8: error: 'n' was not declared in this scope
    6 |     if(n < m)
      |        ^
wiring.cpp:6:12: error: 'm' was not declared in this scope
    6 |     if(n < m)
      |            ^
wiring.cpp:8:14: error: 'a' was not declared in this scope
    8 |         swap(a,b);
      |              ^
wiring.cpp:12:13: error: 'n' was not declared in this scope
   12 |     int i = n-1,j=m-1;
      |             ^
wiring.cpp:13:11: error: 'j' was not declared in this scope
   13 |     while(j >= 0)
      |           ^
wiring.cpp:15:23: error: 'a' was not declared in this scope
   15 |         answer += abs(a[i] - b[j]);
      |                       ^
wiring.cpp:15:19: error: 'abs' was not declared in this scope
   15 |         answer += abs(a[i] - b[j]);
      |                   ^~~
wiring.cpp:23:23: error: 'a' was not declared in this scope
   23 |         answer += abs(a[i] - b[m-1]);
      |                       ^
wiring.cpp:23:32: error: 'm' was not declared in this scope
   23 |         answer += abs(a[i] - b[m-1]);
      |                                ^
wiring.cpp:23:19: error: 'abs' was not declared in this scope
   23 |         answer += abs(a[i] - b[m-1]);
      |                   ^~~