Submission #94327

#TimeUsernameProblemLanguageResultExecution timeMemory
94327fedoseevtimofeyXylophone (JOI18_xylophone)C++14
Compilation error
0 ms0 KiB
#include "xylophone.h" void solve(int n) { int r = n; while (query(1, r) == n - 1) --r; ++r; vector <int> a(n + 1, -1); a[r] = n; if (r != n) { a[r + 1] = n - query(r, r + 1); } if (r != 1) { a[r - 1] = n - query(r - 1, r); } for (int i = r - 2; i >= 1; --i) { int x = query(i, i + 1); int y = query(i, i + 2); for (int z = 1; z <= n; ++z) { a[i] = z; if (my_query(i, i + 1, a) == x && my_query(i, i + 2, a) == y) { break; } } assert(a[i] != -1); } for (int i = r + 2; i <= n; ++i) { int x = query(i - 1, i); int y = query(i - 2, i); for (int z = 1; z <= n; ++z) { a[i] = z; if (my_query(i - 1, i, a) == x && my_query(i - 2, i, a) == y) { break; } } assert(a[i] != -1); } for (int i = 1; i <= n; ++i) { answer(i, a[i]); } }

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:7:5: error: 'vector' was not declared in this scope
     vector <int> a(n + 1, -1);
     ^~~~~~
xylophone.cpp:7:13: error: expected primary-expression before 'int'
     vector <int> a(n + 1, -1);
             ^~~
xylophone.cpp:8:5: error: 'a' was not declared in this scope
     a[r] = n;
     ^
xylophone.cpp:20:17: error: 'my_query' was not declared in this scope
             if (my_query(i, i + 1, a) == x && my_query(i, i + 2, a) == y) {
                 ^~~~~~~~
xylophone.cpp:20:17: note: suggested alternative: 'query'
             if (my_query(i, i + 1, a) == x && my_query(i, i + 2, a) == y) {
                 ^~~~~~~~
                 query
xylophone.cpp:24:9: error: 'assert' was not declared in this scope
         assert(a[i] != -1);
         ^~~~~~
xylophone.cpp:24:9: note: suggested alternative: 'answer'
         assert(a[i] != -1);
         ^~~~~~
         answer
xylophone.cpp:31:17: error: 'my_query' was not declared in this scope
             if (my_query(i - 1, i, a) == x && my_query(i - 2, i, a) == y) {
                 ^~~~~~~~
xylophone.cpp:31:17: note: suggested alternative: 'query'
             if (my_query(i - 1, i, a) == x && my_query(i - 2, i, a) == y) {
                 ^~~~~~~~
                 query
xylophone.cpp:35:9: error: 'assert' was not declared in this scope
         assert(a[i] != -1);
         ^~~~~~
xylophone.cpp:35:9: note: suggested alternative: 'answer'
         assert(a[i] != -1);
         ^~~~~~
         answer