답안 #1072011

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1072011 2024-08-23T13:16:24 Z vjudge1 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
3000 ms 162388 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define nn "\n";
const int N = 2e6 + 8  , inf = 1e9+7 ;
int  n , m , q ;
signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin>> n >> q;
    int w[n+1] , l[q+1] , r[q+1] , k[q+1] , p[n+1];
    int mx1 = max(n , q );
    int mx2 =0 ;
    p[1] =0 ;
    for(int i= 1 ; i <= n; i++){
        cin>> w[i];
        if(i > 1 ) {
            p[i] = p[i - 1];
            if(w[i]>= w[i-1])p[i]++;
        }
        if(w[i]< mx2) {
            mx2 = max(mx2 , w[i]);
        }
    }
    for(int i =1 ; i <= q; i++){
        cin>> l[i]>> r[i]>> k[i];
    }
    if(mx1 <= 5000){
        for(int i =1 ; i <=  q; i++){
            int mx =w[l[i]] , cnt =0  ;
            for(int j =l[i]+1 ; j <= r[i] ; j++){
                if(w[j]< mx ){
                    cnt = max(cnt , w[j]+mx);
                }
                else mx = w[j];
            }
            if(cnt <= k[i] ){
                cout << 1 << nn
            }
            else cout << 0 << nn
        }
    }
    else{
        for(int i =1 ; i <= q ;q ++){
            if(p[r[i]] - p[l[i]]==r[i]-l[i])cout << 1 << nn
            else cout << 0 << nn
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 5 ms 600 KB Output is correct
14 Correct 8 ms 604 KB Output is correct
15 Correct 8 ms 604 KB Output is correct
16 Correct 11 ms 604 KB Output is correct
17 Correct 8 ms 604 KB Output is correct
18 Correct 11 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3064 ms 162388 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3048 ms 142160 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 5 ms 600 KB Output is correct
14 Correct 8 ms 604 KB Output is correct
15 Correct 8 ms 604 KB Output is correct
16 Correct 11 ms 604 KB Output is correct
17 Correct 8 ms 604 KB Output is correct
18 Correct 11 ms 600 KB Output is correct
19 Execution timed out 3041 ms 146140 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 5 ms 600 KB Output is correct
14 Correct 8 ms 604 KB Output is correct
15 Correct 8 ms 604 KB Output is correct
16 Correct 11 ms 604 KB Output is correct
17 Correct 8 ms 604 KB Output is correct
18 Correct 11 ms 600 KB Output is correct
19 Execution timed out 3064 ms 162388 KB Time limit exceeded
20 Halted 0 ms 0 KB -