제출 #401288

#제출 시각아이디문제언어결과실행 시간메모리
401288NintsiChkhaidzeHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
0 / 100
1412 ms5688 KiB
#include <bits/stdc++.h>
#define pb push_back
#define mod 1000000007
#define ll long long
#define int long long
using namespace std;
const int N = 200005;
int a[N],b[N];
main (){
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    int n,q;
    cin>>n>>q;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    
    while(q--){
        int l,r,k;
        cin>>l>>r>>k;
        
        bool q=1;
        b[l] = 0;
        for (int i= l + 1;i<=r;i++){
            b[i] = b[i - 1];
            if (b[i] < a[i - 1]) b[i] = a[i - 1];
            if (b[i] >= a[i] && b[i] + a[i] > k) {q=0; break;}
        }
        cout<<q<<"\n";
    }
}

컴파일 시 표준 에러 (stderr) 메시지

sortbooks.cpp:9:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main (){
      |       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...