제출 #383665

#제출 시각아이디문제언어결과실행 시간메모리
383665aris12345678전선 연결 (IOI17_wiring)C++14
컴파일 에러
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;
}

컴파일 시 표준 에러 (stderr) 메시지

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/ccBWOc9p.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccjeTdYP.o:wiring.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status