답안 #885736

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
885736 2023-12-10T15:12:10 Z Ninedesu Pilot (NOI19_pilot) C++14
78 / 100
1000 ms 3616 KB
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
using namespace std;

const int N=1e6+1;
int n,q;
int arr[N];
bool chk=true;
pii qst[N];

int main(){
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> n >> q;
    for(int i=1; i<=n; i++){
        cin >> arr[i];
        if(arr[i]<arr[i-1])chk=false;
    }
    if(chk==true){
        while(q--){
            int h;
            cin >> h;
            int idx=upper_bound(arr+1,arr+n+1,h)-arr-1;
            cout << ((ll)idx*(idx+1))/2 << '\n';
        }
    }
    else{
        while(q--){
            int h;
            ll ans=0,cnt=0;
            cin >> h;
            for(int i=1; i<=n; i++){
                if(arr[i]<h+1)cnt++;
                if(arr[i]>=h+1||i==n){
                    ans+=(cnt*(cnt+1))/2;
                cnt=0;
                }
            }
            cout << ans << '\n';
        }
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2392 KB Output is correct
13 Correct 0 ms 2508 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2392 KB Output is correct
13 Correct 0 ms 2508 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2392 KB Output is correct
13 Correct 0 ms 2508 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 2 ms 2392 KB Output is correct
22 Correct 3 ms 2396 KB Output is correct
23 Correct 2 ms 2396 KB Output is correct
24 Correct 3 ms 2396 KB Output is correct
25 Correct 2 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 2392 KB Output is correct
2 Correct 7 ms 2396 KB Output is correct
3 Correct 6 ms 2396 KB Output is correct
4 Correct 6 ms 2512 KB Output is correct
5 Correct 6 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 3256 KB Output is correct
2 Correct 26 ms 3412 KB Output is correct
3 Correct 30 ms 3268 KB Output is correct
4 Correct 25 ms 3416 KB Output is correct
5 Correct 25 ms 3616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 3416 KB Output is correct
2 Correct 34 ms 3428 KB Output is correct
3 Correct 30 ms 3408 KB Output is correct
4 Correct 29 ms 3284 KB Output is correct
5 Correct 31 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 7 ms 2392 KB Output is correct
12 Correct 7 ms 2396 KB Output is correct
13 Correct 6 ms 2396 KB Output is correct
14 Correct 6 ms 2512 KB Output is correct
15 Correct 6 ms 2396 KB Output is correct
16 Correct 6 ms 2396 KB Output is correct
17 Correct 7 ms 2396 KB Output is correct
18 Correct 7 ms 2396 KB Output is correct
19 Correct 6 ms 2396 KB Output is correct
20 Correct 10 ms 2516 KB Output is correct
21 Correct 6 ms 2396 KB Output is correct
22 Correct 7 ms 2516 KB Output is correct
23 Correct 7 ms 2392 KB Output is correct
24 Correct 7 ms 2396 KB Output is correct
25 Correct 7 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2392 KB Output is correct
13 Correct 0 ms 2508 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 2 ms 2392 KB Output is correct
22 Correct 3 ms 2396 KB Output is correct
23 Correct 2 ms 2396 KB Output is correct
24 Correct 3 ms 2396 KB Output is correct
25 Correct 2 ms 2396 KB Output is correct
26 Correct 7 ms 2392 KB Output is correct
27 Correct 7 ms 2396 KB Output is correct
28 Correct 6 ms 2396 KB Output is correct
29 Correct 6 ms 2512 KB Output is correct
30 Correct 6 ms 2396 KB Output is correct
31 Correct 25 ms 3256 KB Output is correct
32 Correct 26 ms 3412 KB Output is correct
33 Correct 30 ms 3268 KB Output is correct
34 Correct 25 ms 3416 KB Output is correct
35 Correct 25 ms 3616 KB Output is correct
36 Correct 28 ms 3416 KB Output is correct
37 Correct 34 ms 3428 KB Output is correct
38 Correct 30 ms 3408 KB Output is correct
39 Correct 29 ms 3284 KB Output is correct
40 Correct 31 ms 3412 KB Output is correct
41 Correct 6 ms 2396 KB Output is correct
42 Correct 7 ms 2396 KB Output is correct
43 Correct 7 ms 2396 KB Output is correct
44 Correct 6 ms 2396 KB Output is correct
45 Correct 10 ms 2516 KB Output is correct
46 Correct 6 ms 2396 KB Output is correct
47 Correct 7 ms 2516 KB Output is correct
48 Correct 7 ms 2392 KB Output is correct
49 Correct 7 ms 2396 KB Output is correct
50 Correct 7 ms 2396 KB Output is correct
51 Execution timed out 1059 ms 3540 KB Time limit exceeded
52 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 1 ms 2392 KB Output is correct
13 Correct 0 ms 2508 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 2 ms 2392 KB Output is correct
22 Correct 3 ms 2396 KB Output is correct
23 Correct 2 ms 2396 KB Output is correct
24 Correct 3 ms 2396 KB Output is correct
25 Correct 2 ms 2396 KB Output is correct
26 Correct 7 ms 2392 KB Output is correct
27 Correct 7 ms 2396 KB Output is correct
28 Correct 6 ms 2396 KB Output is correct
29 Correct 6 ms 2512 KB Output is correct
30 Correct 6 ms 2396 KB Output is correct
31 Correct 25 ms 3256 KB Output is correct
32 Correct 26 ms 3412 KB Output is correct
33 Correct 30 ms 3268 KB Output is correct
34 Correct 25 ms 3416 KB Output is correct
35 Correct 25 ms 3616 KB Output is correct
36 Correct 28 ms 3416 KB Output is correct
37 Correct 34 ms 3428 KB Output is correct
38 Correct 30 ms 3408 KB Output is correct
39 Correct 29 ms 3284 KB Output is correct
40 Correct 31 ms 3412 KB Output is correct
41 Correct 6 ms 2396 KB Output is correct
42 Correct 7 ms 2396 KB Output is correct
43 Correct 7 ms 2396 KB Output is correct
44 Correct 6 ms 2396 KB Output is correct
45 Correct 10 ms 2516 KB Output is correct
46 Correct 6 ms 2396 KB Output is correct
47 Correct 7 ms 2516 KB Output is correct
48 Correct 7 ms 2392 KB Output is correct
49 Correct 7 ms 2396 KB Output is correct
50 Correct 7 ms 2396 KB Output is correct
51 Execution timed out 1059 ms 3540 KB Time limit exceeded
52 Halted 0 ms 0 KB -