Submission #363177

#TimeUsernameProblemLanguageResultExecution timeMemory
363177teewarXylophone (JOI18_xylophone)C++14
Compilation error
0 ms0 KiB
#include "xylophone.h"

void solve(int n) {
    int l = 1, r = n;
    while(r - l > 1) {
        int m = (l + r) / 2;
        if(query(1, m) == n - 1) {
            r = m;
        }
        else {
            l = m;
        }
    }
    int mxpos = r;
    int a[n + 1];
    for(int i = 1; i <= n; ++i) {
        int val;
        if(i <= mxpos) {
            val = query(i, mxpos);
        }
        else {
            val = query(mxpos, i);
        }
        a[i] = n - val;
    }
    for(int i = 1; i <= n; ++i) {
        cout << answer(i, a[i]);
    }
}

Compilation message (stderr)

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:27:9: error: 'cout' was not declared in this scope
   27 |         cout << answer(i, a[i]);
      |         ^~~~