Submission #1230801

#TimeUsernameProblemLanguageResultExecution timeMemory
1230801AndreasKHandcrafted Gift (IOI20_gift)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "gift.h" using namespace std; #define designed ios_base::sync_with_stdio(0); #define by cin.tie(0); #define AndreasK cout.tie(0); //#define int long long #define akinput freopen("akinput.txt", "r", stdin); #define akoutput freopen("akoutput.txt", "w", stdout); int construct(int n, int r, int[] a, int[] b, int[] x) { if (x[0] == 1) craft(string(n, 'R')); else { string s = ""; for (int c = 0; c < n; c++) if (c % 2 == 0) s += 'R'; else s += 'B'; craft(s); } return 1; }

Compilation message (stderr)

gift.cpp:12:35: error: expected ',' or '...' before 'a'
   12 | int construct(int n, int r, int[] a, int[] b, int[] x) {
      |                                   ^
gift.cpp: In function 'int construct(int, int, int*)':
gift.cpp:13:9: error: 'x' was not declared in this scope
   13 |     if (x[0] == 1)
      |         ^
gift.cpp:14:15: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   14 |         craft(string(n, 'R'));
      |               ^~~~~~~~~~~~~~
In file included from gift.cpp:2:
gift.h:5:25: note:   initializing argument 1 of 'void craft(std::string&)'
    5 | void craft(std::string &s);
      |            ~~~~~~~~~~~~~^