답안 #1071662

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071662 2024-08-23T09:46:55 Z vjudge1 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
301 ms 41360 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define nn "\n";
const int N = 2e5 + 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[0] =0 ;
    for(int i= 1 ; i <= n; i++){
        cin>> w[i];
        p[i] = p[i-1];
        if(w[i]< mx2){
            mx2 = max(mx2 , w[i]);
            p[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 ; i++){
            if(p[r[i]] - p[l[i-1]]==0)cout << 1<< nn
            else cout << 0 << nn
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 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 1 ms 424 KB Output is correct
9 Correct 0 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 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 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 1 ms 424 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 4 ms 604 KB Output is correct
13 Correct 5 ms 604 KB Output is correct
14 Correct 7 ms 604 KB Output is correct
15 Correct 7 ms 604 KB Output is correct
16 Correct 12 ms 752 KB Output is correct
17 Correct 10 ms 600 KB Output is correct
18 Correct 12 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 301 ms 41360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 25 ms 4432 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 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 1 ms 424 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 4 ms 604 KB Output is correct
13 Correct 5 ms 604 KB Output is correct
14 Correct 7 ms 604 KB Output is correct
15 Correct 7 ms 604 KB Output is correct
16 Correct 12 ms 752 KB Output is correct
17 Correct 10 ms 600 KB Output is correct
18 Correct 12 ms 604 KB Output is correct
19 Incorrect 63 ms 13432 KB Output isn't correct
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 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 1 ms 424 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Correct 4 ms 604 KB Output is correct
13 Correct 5 ms 604 KB Output is correct
14 Correct 7 ms 604 KB Output is correct
15 Correct 7 ms 604 KB Output is correct
16 Correct 12 ms 752 KB Output is correct
17 Correct 10 ms 600 KB Output is correct
18 Correct 12 ms 604 KB Output is correct
19 Incorrect 301 ms 41360 KB Output isn't correct
20 Halted 0 ms 0 KB -