Submission #320934

# Submission time Handle Problem Language Result Execution time Memory
320934 2020-11-10T09:39:37 Z strawberry2005 Pilot (NOI19_pilot) C++14
78 / 100
1000 ms 3044 KB
#include<bits/stdc++.h>
#define deb(x) cout<<#x<<": "<<x<<endl

using namespace std;

int main(){

    long long n,q;
    cin>>n>>q;
    long long heights[n],planes[q];
    for(int i=0;i<n;i++) cin>>heights[i];
    for(int i=0;i<q;i++) cin>>planes[i];


    if(is_sorted(heights,heights+n)){
        //cout<<"HELLO\n";
        for(int i=0;i<q;i++){
            long long reach_height=planes[i];
            long long ans=0;
            
            long long f=upper_bound(heights,heights+n,planes[i])-heights;
            ans=f*(f+1)/2;
            
            cout<<ans<<endl;
        }
    }
    
    else{

        for(int i=0;i<q;i++){
            long long reach_height=planes[i];
            long long count=0,ans=0;
            for(int j=0;j<n;j++){
                if(heights[j]<=reach_height) count++;
                else{
                    ans+=count*(count+1)/2;
                    count=0;
                    
                }
            
            }
            if(count!=0) ans+=count*(count+1)/2;
            cout<<ans<<endl;
        }
    }


    return(0);
}

Compilation message

pilot.cpp: In function 'int main()':
pilot.cpp:18:23: warning: unused variable 'reach_height' [-Wunused-variable]
   18 |             long long reach_height=planes[i];
      |                       ^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 5 ms 364 KB Output is correct
22 Correct 7 ms 364 KB Output is correct
23 Correct 5 ms 364 KB Output is correct
24 Correct 6 ms 384 KB Output is correct
25 Correct 5 ms 372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 996 KB Output is correct
2 Correct 32 ms 1124 KB Output is correct
3 Correct 32 ms 996 KB Output is correct
4 Correct 28 ms 1004 KB Output is correct
5 Correct 26 ms 1004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 274 ms 2684 KB Output is correct
2 Correct 283 ms 2788 KB Output is correct
3 Correct 282 ms 3044 KB Output is correct
4 Correct 276 ms 2916 KB Output is correct
5 Correct 285 ms 2732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 284 ms 2736 KB Output is correct
2 Correct 295 ms 2916 KB Output is correct
3 Correct 316 ms 2788 KB Output is correct
4 Correct 278 ms 2788 KB Output is correct
5 Correct 312 ms 3004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 28 ms 996 KB Output is correct
12 Correct 32 ms 1124 KB Output is correct
13 Correct 32 ms 996 KB Output is correct
14 Correct 28 ms 1004 KB Output is correct
15 Correct 26 ms 1004 KB Output is correct
16 Correct 28 ms 1004 KB Output is correct
17 Correct 31 ms 1124 KB Output is correct
18 Correct 31 ms 1132 KB Output is correct
19 Correct 26 ms 1004 KB Output is correct
20 Correct 31 ms 996 KB Output is correct
21 Correct 26 ms 1004 KB Output is correct
22 Correct 29 ms 996 KB Output is correct
23 Correct 29 ms 1132 KB Output is correct
24 Correct 29 ms 1004 KB Output is correct
25 Correct 29 ms 1004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 5 ms 364 KB Output is correct
22 Correct 7 ms 364 KB Output is correct
23 Correct 5 ms 364 KB Output is correct
24 Correct 6 ms 384 KB Output is correct
25 Correct 5 ms 372 KB Output is correct
26 Correct 28 ms 996 KB Output is correct
27 Correct 32 ms 1124 KB Output is correct
28 Correct 32 ms 996 KB Output is correct
29 Correct 28 ms 1004 KB Output is correct
30 Correct 26 ms 1004 KB Output is correct
31 Correct 274 ms 2684 KB Output is correct
32 Correct 283 ms 2788 KB Output is correct
33 Correct 282 ms 3044 KB Output is correct
34 Correct 276 ms 2916 KB Output is correct
35 Correct 285 ms 2732 KB Output is correct
36 Correct 284 ms 2736 KB Output is correct
37 Correct 295 ms 2916 KB Output is correct
38 Correct 316 ms 2788 KB Output is correct
39 Correct 278 ms 2788 KB Output is correct
40 Correct 312 ms 3004 KB Output is correct
41 Correct 28 ms 1004 KB Output is correct
42 Correct 31 ms 1124 KB Output is correct
43 Correct 31 ms 1132 KB Output is correct
44 Correct 26 ms 1004 KB Output is correct
45 Correct 31 ms 996 KB Output is correct
46 Correct 26 ms 1004 KB Output is correct
47 Correct 29 ms 996 KB Output is correct
48 Correct 29 ms 1132 KB Output is correct
49 Correct 29 ms 1004 KB Output is correct
50 Correct 29 ms 1004 KB Output is correct
51 Execution timed out 1099 ms 1892 KB Time limit exceeded
52 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 5 ms 364 KB Output is correct
22 Correct 7 ms 364 KB Output is correct
23 Correct 5 ms 364 KB Output is correct
24 Correct 6 ms 384 KB Output is correct
25 Correct 5 ms 372 KB Output is correct
26 Correct 28 ms 996 KB Output is correct
27 Correct 32 ms 1124 KB Output is correct
28 Correct 32 ms 996 KB Output is correct
29 Correct 28 ms 1004 KB Output is correct
30 Correct 26 ms 1004 KB Output is correct
31 Correct 274 ms 2684 KB Output is correct
32 Correct 283 ms 2788 KB Output is correct
33 Correct 282 ms 3044 KB Output is correct
34 Correct 276 ms 2916 KB Output is correct
35 Correct 285 ms 2732 KB Output is correct
36 Correct 284 ms 2736 KB Output is correct
37 Correct 295 ms 2916 KB Output is correct
38 Correct 316 ms 2788 KB Output is correct
39 Correct 278 ms 2788 KB Output is correct
40 Correct 312 ms 3004 KB Output is correct
41 Correct 28 ms 1004 KB Output is correct
42 Correct 31 ms 1124 KB Output is correct
43 Correct 31 ms 1132 KB Output is correct
44 Correct 26 ms 1004 KB Output is correct
45 Correct 31 ms 996 KB Output is correct
46 Correct 26 ms 1004 KB Output is correct
47 Correct 29 ms 996 KB Output is correct
48 Correct 29 ms 1132 KB Output is correct
49 Correct 29 ms 1004 KB Output is correct
50 Correct 29 ms 1004 KB Output is correct
51 Execution timed out 1099 ms 1892 KB Time limit exceeded
52 Halted 0 ms 0 KB -