Submission #824232

# Submission time Handle Problem Language Result Execution time Memory
824232 2023-08-13T19:34:58 Z Liudas Radio Towers (IOI22_towers) C++17
0 / 100
4000 ms 1436 KB
#include "towers.h"

#include <cassert>
#include <cstdio>

#include <bits/stdc++.h>
using namespace std;
vector<int> h;
void init(int N, vector<int> H){
    h = H;
}
int max_towers(int L, int R, int D){
    int score = 0;
    for(int i = 0; i < h.size(); i ++){
        int H = h[i];
        int s = 0;
        bool good = false;
        for(int j = L; j <= R; j ++){
            if(!good && h[j] + D <= H){
                s ++;
                good = true;
            }
            else if(good && h[j] >= H){
                good = false;
            }
        }
        score = max(score, s);
    }
    return max(1, score);
}

Compilation message

towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:14:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int i = 0; i < h.size(); i ++){
      |                    ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 4038 ms 976 KB Time limit exceeded
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: '11'
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: '11'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4037 ms 1436 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4057 ms 464 KB Time limit exceeded
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: '11'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4038 ms 976 KB Time limit exceeded
2 Halted 0 ms 0 KB -