제출 #434570

#제출 시각아이디문제언어결과실행 시간메모리
434570medmdg전선 연결 (IOI17_wiring)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> //#include "wiring.h" #define ll long long using namespace std; long long min_total_length(std::vector<int> r, std::vector<int> b) { ll c=0; ll x=0,y=10000000000; for(int i=0;i<r.size();i++){ x=max(x,(ll)(r[i])); c-=r[i]; } c-=max((ll)(0),((ll)(b.size())-(ll)(r.size()))*x); for(int i=0;i<b.size();i++){ y=min(y,(ll)(b[i])); c+=b[i]; } c+=max((ll)(0),((ll)(r.size())-(ll)(b.size()))*y); return c; } int main(){ ll r,b; freopen("inp.txt","r",stdin); cin>>r>>b; vector<int> ra(r),ba(b); for(int i=0;i<r;i++) cin>>ra[i]; for(int i=0;i<b;i++){ cin>>ba[i]; } cout<<min_total_length(ra,ba)<<endl; }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:8:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |         for(int i=0;i<r.size();i++){
      |                     ~^~~~~~~~~
wiring.cpp:13:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |         for(int i=0;i<b.size();i++){
      |                     ~^~~~~~~~~
wiring.cpp: In function 'int main()':
wiring.cpp:22:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     freopen("inp.txt","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccCIClbV.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccoT4tuX.o:wiring.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status