답안 #885196

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
885196 2023-12-09T08:36:23 Z adkjt Pilot (NOI19_pilot) C++14
55 / 100
1000 ms 14652 KB
#include<bits/stdc++.h>
using namespace std;
int h[1111111],qu[1111111];
long long ans[1111111];
int main()
{
    int n,q,m=2;
    scanf("%d %d",&n,&q);
    for(int i=1;i<=1000000;i++)
        ans[i]=ans[i-1]+i;
    //if(n>1000||q>1000) m=3;
    for(int i=1;i<=n;i++){
        scanf("%d",&h[i]);
        if(h[i]!=1000000&&m==2) m=0;
        if(h[i]<h[i-1]&&(m==1||m==2)) m=0;
    }
    for(int i=1;i<=q;i++)
        scanf("%d",&qu[i]);
    if(!m)
    {
        for(int i=1;i<=q;i++)
        {
            long long cnt=0,mx=0;
            for(int j=1;j<=n;j++)
            {
                if(qu[i]>=h[j]) cnt++;
                else if(cnt&&j!=n)
                {

                    mx+=ans[cnt];
                    cnt=0;
                }
            }
            mx+=ans[cnt];
            printf("%lld\n",mx);
        }
    }
    else if(m==1)
    {
        for(int i=1;i<=q;i++)
        {
            int x=upper_bound(h+1,h+1+n,qu[i])-(h+1);
            printf("%lld\n",ans[x]);
        }
    }
    else if(m==2)
    {
        int qcnt=0;
        for(int i=1;i<=q;i++)
        {
            if(qu[i]<1000000) printf("0\n");
            else{
                printf("%lld",ans[n]);
            }
        }
    }


}

Compilation message

pilot.cpp: In function 'int main()':
pilot.cpp:48:13: warning: unused variable 'qcnt' [-Wunused-variable]
   48 |         int qcnt=0;
      |             ^~~~
pilot.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d %d",&n,&q);
      |     ~~~~~^~~~~~~~~~~~~~~
pilot.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%d",&h[i]);
      |         ~~~~~^~~~~~~~~~~~
pilot.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         scanf("%d",&qu[i]);
      |         ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 12892 KB Output is correct
2 Correct 4 ms 12920 KB Output is correct
3 Correct 4 ms 12892 KB Output is correct
4 Correct 4 ms 12892 KB Output is correct
5 Correct 4 ms 12892 KB Output is correct
6 Correct 4 ms 12888 KB Output is correct
7 Correct 4 ms 12892 KB Output is correct
8 Correct 4 ms 12888 KB Output is correct
9 Correct 4 ms 12892 KB Output is correct
10 Correct 4 ms 12892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 12892 KB Output is correct
2 Correct 4 ms 12920 KB Output is correct
3 Correct 4 ms 12892 KB Output is correct
4 Correct 4 ms 12892 KB Output is correct
5 Correct 4 ms 12892 KB Output is correct
6 Correct 4 ms 12888 KB Output is correct
7 Correct 4 ms 12892 KB Output is correct
8 Correct 4 ms 12888 KB Output is correct
9 Correct 4 ms 12892 KB Output is correct
10 Correct 4 ms 12892 KB Output is correct
11 Correct 4 ms 12892 KB Output is correct
12 Correct 4 ms 12936 KB Output is correct
13 Correct 4 ms 12892 KB Output is correct
14 Correct 4 ms 12888 KB Output is correct
15 Correct 4 ms 12892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 12892 KB Output is correct
2 Correct 4 ms 12920 KB Output is correct
3 Correct 4 ms 12892 KB Output is correct
4 Correct 4 ms 12892 KB Output is correct
5 Correct 4 ms 12892 KB Output is correct
6 Correct 4 ms 12888 KB Output is correct
7 Correct 4 ms 12892 KB Output is correct
8 Correct 4 ms 12888 KB Output is correct
9 Correct 4 ms 12892 KB Output is correct
10 Correct 4 ms 12892 KB Output is correct
11 Correct 4 ms 12892 KB Output is correct
12 Correct 4 ms 12936 KB Output is correct
13 Correct 4 ms 12892 KB Output is correct
14 Correct 4 ms 12888 KB Output is correct
15 Correct 4 ms 12892 KB Output is correct
16 Correct 4 ms 12892 KB Output is correct
17 Correct 4 ms 12892 KB Output is correct
18 Correct 4 ms 12732 KB Output is correct
19 Correct 4 ms 12892 KB Output is correct
20 Correct 4 ms 12892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 12892 KB Output is correct
2 Correct 4 ms 12920 KB Output is correct
3 Correct 4 ms 12892 KB Output is correct
4 Correct 4 ms 12892 KB Output is correct
5 Correct 4 ms 12892 KB Output is correct
6 Correct 4 ms 12888 KB Output is correct
7 Correct 4 ms 12892 KB Output is correct
8 Correct 4 ms 12888 KB Output is correct
9 Correct 4 ms 12892 KB Output is correct
10 Correct 4 ms 12892 KB Output is correct
11 Correct 4 ms 12892 KB Output is correct
12 Correct 4 ms 12936 KB Output is correct
13 Correct 4 ms 12892 KB Output is correct
14 Correct 4 ms 12888 KB Output is correct
15 Correct 4 ms 12892 KB Output is correct
16 Correct 4 ms 12892 KB Output is correct
17 Correct 4 ms 12892 KB Output is correct
18 Correct 4 ms 12732 KB Output is correct
19 Correct 4 ms 12892 KB Output is correct
20 Correct 4 ms 12892 KB Output is correct
21 Correct 5 ms 12744 KB Output is correct
22 Correct 6 ms 12888 KB Output is correct
23 Correct 6 ms 12892 KB Output is correct
24 Correct 7 ms 12940 KB Output is correct
25 Correct 5 ms 12892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 13404 KB Output is correct
2 Correct 11 ms 13404 KB Output is correct
3 Correct 11 ms 13228 KB Output is correct
4 Correct 10 ms 13404 KB Output is correct
5 Correct 10 ms 13404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1012 ms 14312 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1020 ms 14652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 12892 KB Output is correct
2 Correct 4 ms 12920 KB Output is correct
3 Correct 4 ms 12892 KB Output is correct
4 Correct 4 ms 12892 KB Output is correct
5 Correct 4 ms 12892 KB Output is correct
6 Correct 4 ms 12888 KB Output is correct
7 Correct 4 ms 12892 KB Output is correct
8 Correct 4 ms 12888 KB Output is correct
9 Correct 4 ms 12892 KB Output is correct
10 Correct 4 ms 12892 KB Output is correct
11 Correct 10 ms 13404 KB Output is correct
12 Correct 11 ms 13404 KB Output is correct
13 Correct 11 ms 13228 KB Output is correct
14 Correct 10 ms 13404 KB Output is correct
15 Correct 10 ms 13404 KB Output is correct
16 Correct 12 ms 13404 KB Output is correct
17 Correct 12 ms 13404 KB Output is correct
18 Correct 11 ms 13660 KB Output is correct
19 Correct 10 ms 13404 KB Output is correct
20 Correct 11 ms 13404 KB Output is correct
21 Correct 10 ms 13424 KB Output is correct
22 Correct 11 ms 13404 KB Output is correct
23 Correct 11 ms 13492 KB Output is correct
24 Correct 12 ms 13404 KB Output is correct
25 Correct 11 ms 13296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 12892 KB Output is correct
2 Correct 4 ms 12920 KB Output is correct
3 Correct 4 ms 12892 KB Output is correct
4 Correct 4 ms 12892 KB Output is correct
5 Correct 4 ms 12892 KB Output is correct
6 Correct 4 ms 12888 KB Output is correct
7 Correct 4 ms 12892 KB Output is correct
8 Correct 4 ms 12888 KB Output is correct
9 Correct 4 ms 12892 KB Output is correct
10 Correct 4 ms 12892 KB Output is correct
11 Correct 4 ms 12892 KB Output is correct
12 Correct 4 ms 12936 KB Output is correct
13 Correct 4 ms 12892 KB Output is correct
14 Correct 4 ms 12888 KB Output is correct
15 Correct 4 ms 12892 KB Output is correct
16 Correct 4 ms 12892 KB Output is correct
17 Correct 4 ms 12892 KB Output is correct
18 Correct 4 ms 12732 KB Output is correct
19 Correct 4 ms 12892 KB Output is correct
20 Correct 4 ms 12892 KB Output is correct
21 Correct 5 ms 12744 KB Output is correct
22 Correct 6 ms 12888 KB Output is correct
23 Correct 6 ms 12892 KB Output is correct
24 Correct 7 ms 12940 KB Output is correct
25 Correct 5 ms 12892 KB Output is correct
26 Correct 10 ms 13404 KB Output is correct
27 Correct 11 ms 13404 KB Output is correct
28 Correct 11 ms 13228 KB Output is correct
29 Correct 10 ms 13404 KB Output is correct
30 Correct 10 ms 13404 KB Output is correct
31 Execution timed out 1012 ms 14312 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 12892 KB Output is correct
2 Correct 4 ms 12920 KB Output is correct
3 Correct 4 ms 12892 KB Output is correct
4 Correct 4 ms 12892 KB Output is correct
5 Correct 4 ms 12892 KB Output is correct
6 Correct 4 ms 12888 KB Output is correct
7 Correct 4 ms 12892 KB Output is correct
8 Correct 4 ms 12888 KB Output is correct
9 Correct 4 ms 12892 KB Output is correct
10 Correct 4 ms 12892 KB Output is correct
11 Correct 4 ms 12892 KB Output is correct
12 Correct 4 ms 12936 KB Output is correct
13 Correct 4 ms 12892 KB Output is correct
14 Correct 4 ms 12888 KB Output is correct
15 Correct 4 ms 12892 KB Output is correct
16 Correct 4 ms 12892 KB Output is correct
17 Correct 4 ms 12892 KB Output is correct
18 Correct 4 ms 12732 KB Output is correct
19 Correct 4 ms 12892 KB Output is correct
20 Correct 4 ms 12892 KB Output is correct
21 Correct 5 ms 12744 KB Output is correct
22 Correct 6 ms 12888 KB Output is correct
23 Correct 6 ms 12892 KB Output is correct
24 Correct 7 ms 12940 KB Output is correct
25 Correct 5 ms 12892 KB Output is correct
26 Correct 10 ms 13404 KB Output is correct
27 Correct 11 ms 13404 KB Output is correct
28 Correct 11 ms 13228 KB Output is correct
29 Correct 10 ms 13404 KB Output is correct
30 Correct 10 ms 13404 KB Output is correct
31 Execution timed out 1012 ms 14312 KB Time limit exceeded
32 Halted 0 ms 0 KB -