codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1057B.md (1415B)


      1 Source: https://codeforces.com/problemset/problem/1057/B
      2 
      3 B. DDoS
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 We get more and more news about DDoS-attacks of popular websites.
     22 
     23 Arseny is an admin and he thinks that a website is under a DDoS-attack if the total number of requests for a some period of time exceeds $100 \cdot t$, where $t$ — the number of seconds in this time segment.
     24 
     25 Arseny knows statistics on the number of requests per second since the server is booted. He knows the sequence $r_1, r_2, \dots, r_n$, where $r_i$ — the number of requests in the $i$-th second after boot.
     26 
     27 Determine the length of the longest continuous period of time, which Arseny considers to be a DDoS-attack. A seeking time period should not go beyond the boundaries of the segment $[1, n]$.
     28 
     29 Input
     30 
     31 The first line contains $n$ ($1 \le n \le 5000$) — number of seconds since server has been booted. The second line contains sequence of integers $r_1, r_2, \dots, r_n$ ($0 \le r_i \le 5000$), $r_i$ — number of requests in the $i$-th second.
     32 
     33 Output
     34 
     35 Print the only integer number — the length of the longest time period which is considered to be a DDoS-attack by Arseny. If it doesn't exist print 0.
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 5  
     43 100 200 1 1 1
     44 ```
     45 
     46 Output
     47 
     48 ```
     49 3
     50 ```
     51 
     52 Input
     53 
     54 ```
     55 5  
     56 1 2 3 4 5
     57 ```
     58 
     59 Output
     60 
     61 ```
     62 0
     63 ```
     64 
     65 Input
     66 
     67 ```
     68 2  
     69 101 99
     70 ```
     71 
     72 Output
     73 
     74 ```
     75 1
     76 ```