| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 843073 | yahyobekabdunazarov | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++17 | 364 ms | 18064 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define int long long
#define pii pair<int, int>
#define ff first
#define ss second
//... max1 .... max2
//... max2 .... max1
using namespace std;
const int maxn = 1e6 + 9;
int f[maxn];
void upd(int n){
    while(n < maxn){
        f[n]++;
        n += n & -n;
    }
}
int summa(int n){
    int sm = 0;
    while(n){
        sm += f[n];
        n -= n & -n;
    }
    return sm;
}
int summa(int l, int r){
    return summa(r) - summa(l - 1);
}
void solve(){  
    int n, m;
    cin >> n >> m;
    int a[n + 1];
    a[0] = 0;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        if(a[i] >= a[i - 1]) upd(i);
    }
    while(m--){
        int l, r, k, mx = 0, sum = 0, ok = 1;
        cin >> l >> r >> k;
        if(n <= 5000 && m <= 5000){
            for(int i = l; i <= r; i++){
                sum = max(sum, (a[i] + mx) * (a[i] < mx));
                mx = max(mx, a[i]);
            }
            cout << (sum <= k ? "1\n" : "0\n");
        }
        else{
            cout << (summa(l, r) >= r - l ? "1\n" : "0\n");
        }
    }
}
int32_t main(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
 
    int t = 1;  
    //cin >> t;
    while(t--){
        solve();
        cout << '\n';
    }
    return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
