Submission #729782

# Submission time Handle Problem Language Result Execution time Memory
729782 2023-04-24T14:26:03 Z Nahian9696 Radio Towers (IOI22_towers) C++17
4 / 100
849 ms 1452 KB
#include "towers.h"

#include <bits/stdc++.h>

using namespace std;


#define f0(i, n) for(int i = 0; i <  (n); i++)
#define f1(i, n) for(int i = 1; i <= (n); i++)
#define pb push_back
#define ff first
#define ss second

typedef vector<int> vi;



vector<int> arr;


bool first_time = true;

int mxind = 0;


void init(int N, std::vector<int> H) {
    arr = H;
    f0(i, N-1) {
        if(arr[i] < arr[i+1]) mxind = i+1;
        else break;
    }
}

int max_towers(int L, int R, int D) {


    if(L >= mxind || R <= mxind) return 1;

    if(arr[L] + D <= arr[mxind] && arr[R] + D <= arr[mxind]) return 2;
    return 1;




    // if(first_time) {
        // vi hh = vector(arr.begin()+L, arr.end()+R+1);
        // int n = R - L + 1;
        // int prefmin[n], sufmin[n];
        // prefmin[0] = hh[0];
        // sufmin[n-1] = hh[n-1];

        // f1(i, n-1) {
        //     prefmin[i] = min(hh[i], prefmin[i-1]);
        //     sufmin[n - i + 1] = min(hh[n-i+1], sufmin[n-i]);
        // }

        // int ans = -1;
        // f0(i, n) {
        //     if (
        //             prefmin[i] + D <= hh[i] &&
        //             sufmin[i] + D <= hh[i]
        //         ) {
        //         ans = max(ans, hh[i]);
        //     }
        // }

        // if(ans == -1) return 0;

        // // sort(hh.begin(), hh.end());

        // int ret = 0;

        // f0(i, n) if(hh[i] + D <= ans) ret ++;

        // return ret;


        // first_time = false;
    // }




    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 330 ms 916 KB Output is correct
2 Correct 849 ms 1440 KB Output is correct
3 Correct 842 ms 1352 KB Output is correct
4 Correct 832 ms 1432 KB Output is correct
5 Correct 785 ms 1352 KB Output is correct
6 Correct 603 ms 1436 KB Output is correct
7 Correct 659 ms 1356 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 520 ms 1452 KB 1st lines differ - on the 1st token, expected: '11903', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 302 ms 560 KB 1st lines differ - on the 1st token, expected: '7197', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 330 ms 916 KB Output is correct
2 Correct 849 ms 1440 KB Output is correct
3 Correct 842 ms 1352 KB Output is correct
4 Correct 832 ms 1432 KB Output is correct
5 Correct 785 ms 1352 KB Output is correct
6 Correct 603 ms 1436 KB Output is correct
7 Correct 659 ms 1356 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
12 Halted 0 ms 0 KB -