Submission #383664

#TimeUsernameProblemLanguageResultExecution timeMemory
383664aris12345678Wiring (IOI17_wiring)C++14
Compilation error
0 ms0 KiB
#include "wiring.h";
#include <bits/stdc++.h>
using namespace std;

#define int64 long long

const int mxN = 1e6+5;

int64 min_total_length(vector<int> r, vector<int> b) {
    int i = r.size()-1, j = b.size()-1;
    int64 ans = 0;
    while(i >= 0 && j >= 0)
        ans += (b[j]-r[i]), i--, j--;
    while(i >= 0)
        ans += (b[0]-r[i]), i--;
    while(j >= 0)
        ans += (b[j]-r[0]), j--;
    return ans;
}

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    vector<int> r(n), b(m);
    for(int i = 0; i < n; i++)
        scanf("%d", &r[i]);
    for(int i = 0; i < m; i++)
        scanf("%d", &b[i]);
    int64 ans = min_total_length(r, b);
    printf("%lld\n", ans);
    return 0;
}

Compilation message (stderr)

wiring.cpp:1:20: warning: extra tokens at end of #include directive
    1 | #include "wiring.h";
      |                    ^
wiring.cpp: In function 'int main()':
wiring.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   23 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
wiring.cpp:26:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   26 |         scanf("%d", &r[i]);
      |         ~~~~~^~~~~~~~~~~~~
wiring.cpp:28:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   28 |         scanf("%d", &b[i]);
      |         ~~~~~^~~~~~~~~~~~~
/tmp/ccWcPg7V.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccb6kFll.o:wiring.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status