Submission #1071752

# Submission time Handle Problem Language Result Execution time Memory
1071752 2024-08-23T10:49:13 Z beaconmc Radio Towers (IOI22_towers) C++17
0 / 100
4000 ms 1368 KB
#include "towers.h"

 
#include <bits/stdc++.h>
using namespace std;
 
typedef int ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)


vector<int> towers;
int n = 0;

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

}

int max_towers(int L, int R, int D) {
    ll ans = 1;

    for (auto&i : towers){
        ll maxi = i;

        ll temp = 0;
        ll cur = 0;

        FOR(i,L,R+1){
            ll j = towers[i];
            if (j <= maxi && cur==0){
                cur = 1;
                temp += 1;
            }
            else if (j>=maxi+D && cur==1){
                cur = 0;
            }
        }
        ans = max(temp, ans);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4043 ms 924 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '13', found: '11'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '13', found: '11'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4070 ms 1368 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4045 ms 688 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '13', found: '11'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4043 ms 924 KB Time limit exceeded
2 Halted 0 ms 0 KB -