Submission #633414

# Submission time Handle Problem Language Result Execution time Memory
633414 2022-08-22T11:42:26 Z Lawliet Radio Towers (IOI22_towers) C++17
14 / 100
848 ms 1872 KB
#include "towers.h"
#include <bits/stdc++.h>

using namespace std;

const int maxn = 100010;

int n;

int v[maxn];
int dp[maxn];

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

    for(int i = 1 ; i <= n ; i++)
        v[i] = H[i - 1];

    for(int i = 1 ; i <= n ; i++)
    {
        if( v[i - 1] > v[i] && v[i] < v[i + 1] ) 
            dp[i] = 1;

        dp[i] += dp[i - 1];
    }
}

int max_towers(int L, int R, int D) 
{
    L++; R++;
    int ans = dp[R] - dp[L - 1];

    if( L == R )
        return 1;

    if( v[L - 1] < v[L] && v[L] < v[L + 1] )
        ans++;

    if( v[R - 1] > v[R] && v[R] > v[R + 1] )
        ans++;

    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 342 ms 1180 KB 2nd lines differ - on the 1st token, expected: '1', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '16'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '16'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 414 ms 1832 KB Output is correct
2 Correct 577 ms 1836 KB Output is correct
3 Correct 588 ms 1736 KB Output is correct
4 Correct 502 ms 1736 KB Output is correct
5 Correct 769 ms 1872 KB Output is correct
6 Correct 848 ms 1872 KB Output is correct
7 Correct 809 ms 1840 KB Output is correct
8 Correct 696 ms 1736 KB Output is correct
9 Correct 647 ms 1856 KB Output is correct
10 Correct 808 ms 1852 KB Output is correct
11 Correct 744 ms 1836 KB Output is correct
12 Correct 774 ms 1852 KB Output is correct
13 Correct 822 ms 1736 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 21 ms 1856 KB Output is correct
18 Correct 11 ms 1828 KB Output is correct
19 Correct 11 ms 1832 KB Output is correct
20 Correct 11 ms 1840 KB Output is correct
21 Correct 12 ms 1872 KB Output is correct
22 Correct 18 ms 1856 KB Output is correct
23 Correct 12 ms 1828 KB Output is correct
24 Correct 12 ms 1840 KB Output is correct
25 Correct 11 ms 1744 KB Output is correct
26 Correct 11 ms 1828 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 0 ms 336 KB Output is correct
29 Correct 0 ms 336 KB Output is correct
30 Correct 1 ms 316 KB Output is correct
31 Correct 0 ms 336 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 0 ms 208 KB Output is correct
34 Correct 0 ms 208 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 170 ms 592 KB 1st lines differ - on the 1st token, expected: '7197', found: '8004'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '16'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 342 ms 1180 KB 2nd lines differ - on the 1st token, expected: '1', found: '2'
2 Halted 0 ms 0 KB -