제출 #401293

#제출 시각아이디문제언어결과실행 시간메모리
401293NintsiChkhaidzeHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
17 / 100
3076 ms17928 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 = 1000005;
int a[N],b[N],l,r,k,n,q,i;
main (){
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    cin>>n>>q;
    for (i=1;i<=n;i++)
        cin>>a[i];
    
    while(q--){
        cin>>l>>r>>k;
        
        bool q=1;
        b[l] = 0;
        for (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...