QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#182831#1848. Interval ShuffleAphroraTL 0ms3868kbC++14580b2023-09-18 16:35:552023-09-18 16:35:55

Judging History

This is the latest submission verdict.

  • [2023-09-18 16:35:55]
  • Judged
  • Verdict: TL
  • Time: 0ms
  • Memory: 3868kb
  • [2023-09-18 16:35:55]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

int n,m,l,r;
int a[500010],maxx;

int main() {
   // freopen("candy,in","r",stdin);
    //freopen("candy.out","w",stdout);

    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;++i)
        scanf("%d",&a[i]);
    while(m--) {
        maxx=0;
        scanf("%d%d",&l,&r);
        for(int i=l;i<=r;++i)
            maxx=max(maxx,a[i]);
        for(int i=l;i<=r;++i) {
            if(maxx==a[i]) ++a[i];
            else a[i]=maxx;
        }
    }
    for(int i=1;i<=n;++i)
        printf("%d ",a[i]);
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3868kb

input:

4 3
0 1 0 1
2 4
1 3
2 3

output:

2 4 3 2 

result:

ok 4 number(s): "2 4 3 2"

Test #2:

score: -100
Time Limit Exceeded

input:

188394 182563
1 40 31 12 49 8 30 49 46 22 49 36 11 47 15 32 20 18 11 41 4 49 31 28 14 33 27 3 5 30 23 30 36 42 24 5 35 25 8 21 7 7 0 1 10 34 26 16 15 36 39 4 11 41 34 30 7 40 7 26 27 50 6 4 15 12 20 2 16 45 8 37 12 25 33 3 23 16 13 47 33 40 25 8 29 42 25 34 49 17 1 12 37 7 27 11 44 11 38 6 46 17 35 ...

output:


result: