답안 #1083820

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1083820 2024-09-04T08:10:40 Z SamueleVid 송신탑 (IOI22_towers) C++17
4 / 100
688 ms 1368 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

constexpr int MAXN = 1e5;
constexpr int PW = 131072;
vector<int> H;
int k;

void init(int N, vector<int> H) {
    :: H = H;

    k = 0;
    for (int i = 0; i < N - 1; i ++) {
        if (H[i] < H[i + 1]) k = i + 1;
    }
}

int max_towers(int L, int R, int D) {
    if (L >= k || R <= k) return 1;

    int dx = k - 1;
    for (int p = PW; p >= 1; p /= 2) {
        if (p + dx <= R && H[p + dx] > H[k] - D) dx += p;
    }
    dx ++;

    int sx = k + 1;
    for (int p = PW; p >= 1; p /= 2) {
        if (sx - p >= L && H[sx - p] > H[k] - D) sx -= p;
    }
    sx --;

    if (sx >= L && dx <= R) return 2;
    return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 276 ms 1112 KB Output is correct
2 Correct 648 ms 1368 KB Output is correct
3 Correct 688 ms 1368 KB Output is correct
4 Correct 619 ms 1368 KB Output is correct
5 Correct 629 ms 1368 KB Output is correct
6 Correct 650 ms 1368 KB Output is correct
7 Correct 605 ms 1368 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 529 ms 1368 KB 1st lines differ - on the 1st token, expected: '11903', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 221 ms 692 KB 1st lines differ - on the 1st token, expected: '7197', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 276 ms 1112 KB Output is correct
2 Correct 648 ms 1368 KB Output is correct
3 Correct 688 ms 1368 KB Output is correct
4 Correct 619 ms 1368 KB Output is correct
5 Correct 629 ms 1368 KB Output is correct
6 Correct 650 ms 1368 KB Output is correct
7 Correct 605 ms 1368 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
12 Halted 0 ms 0 KB -