Submission #704659

# Submission time Handle Problem Language Result Execution time Memory
704659 2023-03-02T15:03:55 Z bebra Xylophone (JOI18_xylophone) C++17
0 / 100
1 ms 208 KB
#include "xylophone.h"
#include <bits/stdc++.h>
using namespace std;


void solve(int n) {
    vector<int> a(n);
    
    int l = 0;
    int r = n - 1;
    while (l < n - 1) {
        if (query(l + 1, r) == n - 1) {
            ++l;
        } else {
            break;
        }
    }
    a[l] = 1;
    int curr_max = 1;
    for (int i = l + 1; i < n; ++i) {
        a[i] = query(l + 1, i + 1);
        if (a[i] > curr_max) {
            curr_max = a[i];
        } else {
            a[i] = a[i - 1] - query(i - 1 + 1, i + 1);
        }
    }
    for (int i = l - 1; i >= 0; --i) {
        a[i] = query(i + 1, l + 1);
        if (a[i] > curr_max) {
            curr_max = a[i];
        } else {
            a[i] = a[i - 1] - query(i + 1, i + 1 + 1);
        }
    }
	for (int i = 1; i <= n; i++) {
		answer(i, a[i]);
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -