Submission #363179

# Submission time Handle Problem Language Result Execution time Memory
363179 2021-02-05T08:50:39 Z teewar Xylophone (JOI18_xylophone) C++14
0 / 100
1 ms 364 KB
#include "xylophone.h"
#include <iostream>

using namespace std;


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) {
        answer(i, a[i]);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Wrong Answer [7]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Wrong Answer [7]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Wrong Answer [7]
4 Halted 0 ms 0 KB -