Submission #1088408

# Submission time Handle Problem Language Result Execution time Memory
1088408 2024-09-14T10:38:48 Z MateiKing80 A Plus B (IOI23_aplusb) C++17
Compilation error
0 ms 0 KB
#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;
}

Compilation message

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];
      |         ^~~