제출 #959291

#제출 시각아이디문제언어결과실행 시간메모리
959291vjudge1A Plus B (IOI23_aplusb)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int* smallest_sums(int N, int* A, int* B) { multiset<int> res; for(int i=0 ;i<N ;i++) { for(int j=0 ;j<N ;j++) { res.insert(A[i]+B[j]); } } int x[N] ; multiset<int>::iterator itr= res.begin(); int i =0; while (N--) { x[i] = *itr; i++ ; ++itr; } return x; }

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

aplusb.cpp: In function 'int* smallest_sums(int, int*, int*)':
aplusb.cpp:19:12: warning: address of local variable 'x' returned [-Wreturn-local-addr]
   19 |     return x;
      |            ^
aplusb.cpp:11:9: note: declared here
   11 |     int x[N] ;
      |         ^
/usr/bin/ld: /tmp/ccyPk8sJ.o: in function `main':
grader.cpp:(.text.startup+0x271): undefined reference to `smallest_sums(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status