[Offer收割]编程练习赛40 register

Ended

Participants:189

Verdict:Time Limit Exceeded
Score:30 / 100
Submitted:2017-12-17 12:52:52

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include<iostream>
#include<algorithm>
using namespace std;
int a[100010];
int main()
{
    int n;
    int l,r;
    cin>>n;
    while(n--)
    {
        cin>>l>>r;
        int max = 0;
        for(int i = l; i <= r; i++)
        {
            a[i]++;
        }
//      for(int i = 1; i <= 19; i++)
//          cout<<a[i]<<" ";
//      cout<<endl;
        max = *max_element(a+l,a+r+1);
        cout<<max<<endl;
        for(int i = l; i <= r; i++)
            a[i] = max;
    }
    
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX