답안 #799950

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
799950 2023-08-01T08:46:49 Z adrilen 송신탑 (IOI22_towers) C++17
0 / 100
10 ms 1872 KB
#include "towers.h"
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using arr = array<int, 2>;
using arrr = array<int, 3>;
constexpr int maxn = 1e5 + 5;
int n;

int pref[maxn] = { 0 };
int h[maxn] = { 0 };

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

    for (int i = 0; i < n; i++) h[i] = H[i];

    if (n < 3) return ;

    if (H[0] < H[1]) pref[0] ++;
    for( int i = 1; i < n - 1;i++) pref[i] += (H[i - 1] > H[i] && H[i] < H[i + 1]);
    if (H[n - 1] < H[n - 2]) pref[n - 1]++;
    for (int i = 1; i < n; i++) pref[i] += pref[i - 1];


    for (int i = 0; i < n; i++) cout << pref[i] << " ";
    cout << "\n";
}

int max_towers(int L, int R, int D) {
    if (R - L < 2) return 1;

    int output = pref[R] - (L != 0 ? pref[L - 1] : 0);
    if (L != 0 && pref[L] == pref[L - 1]) output += (h[L] < h[L + 1]);

    if (R != n - 1 && pref[R] == pref[R - 1]) output += (h[R] < h[R - 1]);

    return output;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 1232 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Possible tampering with the output or unexpected termination of the program
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Possible tampering with the output or unexpected termination of the program
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 10 ms 1872 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 688 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Possible tampering with the output or unexpected termination of the program
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 1232 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -