제출 #1088408

#제출 시각아이디문제언어결과실행 시간메모리
1088408MateiKing80A 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[]) { sort(a, a + n); sort(b, b + n); vector<int> x; for(int i = 0; i < n; i ++) for(int j = 0; j < n / (i + 1); j ++) x.push_back(a[i] + b[j]); sort(all(x)); int ans[100005]; for(int i = 0; i < n; i ++) ans[i] = x[i]; return ans; }

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

aplusb.cpp: In function 'int* smallest_sums(int, int*, int*)':
aplusb.cpp:13:10: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   13 |     sort(all(x));
      |          ^~~
      |          std::filesystem::perms::all
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from aplusb.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here
  148 |       all  =  0777,
      |       ^~~
aplusb.cpp:17:12: warning: address of local variable 'ans' returned [-Wreturn-local-addr]
   17 |     return ans;
      |            ^~~
aplusb.cpp:14:9: note: declared here
   14 |     int ans[100005];
      |         ^~~