Submission #1067157

#TimeUsernameProblemLanguageResultExecution timeMemory
1067157ChericMACA Plus B (IOI23_aplusb)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <algorithm> using namespace std; int[] smallest_sums(int N, int[] A, int[B]) { int[N * N] C; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { c.append(A[i] + b[j]) } } sort(C.begin(), C.end()); int[N] result; for (int i = 0; i < N; i++) { result.append(C[i]); } return result; } int main() { for (int i: smallest_sums(2, [0, 2], [1, 4])) cout << i << " "; cout << endl; return 0; }

Compilation message (stderr)

aplusb.cpp:5:4: error: structured binding declaration cannot have type 'int'
    5 | int[] smallest_sums(int N, int[] A, int[B]) {
      |    ^~
aplusb.cpp:5:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
aplusb.cpp:5:4: error: empty structured binding declaration
aplusb.cpp:5:7: error: expected initializer before 'smallest_sums'
    5 | int[] smallest_sums(int N, int[] A, int[B]) {
      |       ^~~~~~~~~~~~~
aplusb.cpp: In function 'int main()':
aplusb.cpp:21:35: error: expected identifier before numeric constant
   21 |     for (int i: smallest_sums(2, [0, 2], [1, 4])) cout << i << " ";
      |                                   ^
aplusb.cpp:21:36: error: expected ']' before ',' token
   21 |     for (int i: smallest_sums(2, [0, 2], [1, 4])) cout << i << " ";
      |                                    ^
      |                                    ]
aplusb.cpp: In lambda function:
aplusb.cpp:21:36: error: expected '{' before ',' token
aplusb.cpp: In function 'int main()':
aplusb.cpp:21:39: error: expected ')' before ']' token
   21 |     for (int i: smallest_sums(2, [0, 2], [1, 4])) cout << i << " ";
      |                              ~        ^
      |                                       )
aplusb.cpp:21:39: error: expected ')' before ']' token
   21 |     for (int i: smallest_sums(2, [0, 2], [1, 4])) cout << i << " ";
      |         ~                             ^
      |                                       )
aplusb.cpp:21:39: error: expected primary-expression before ']' token
aplusb.cpp:21:14: warning: unused variable 'i' [-Wunused-variable]
   21 |     for (int i: smallest_sums(2, [0, 2], [1, 4])) cout << i << " ";
      |              ^