답안 #521301

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
521301 2022-02-01T14:43:12 Z dostigator Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
3000 ms 18348 KB
#pragma GCC optimize("O3")
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
using namespace std;
#define IShowSpeed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define popcnt __builtin_popcount
#define all(a) a.begin(),a.end()
#define pii pair<ll,ll>
#define mii map<ll,ll>
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define pb push_back
#define vt vector
#define endl '\n'
#define X first
#define Y second
typedef long double ld;
typedef long long ll;
const ll dx[4]={1,-1,0,0},dy[4]={0,0,1,-1},N=2e6;
const ll mod=1e9+7,inf=1e18;
int n,m;
int a[N];
void solve(){
    cin>>n>>m;
    for(int i=1; i<=n; ++i) cin>>a[i];
    for(int i=1; i<=m; ++i){
        int l,r,k;
        cin>>l>>r>>k;
        int ans=1,mx=0;
        for(int i=l; i<=r; ++i){
            if(a[i]+mx>k && a[i]<mx){
                ans=0;
                break;
            }
            mx=max(mx,a[i]);
        }
        cout<<ans<<endl;
    }
}
int main() {
    IShowSpeed;
    ll tt=1;
    //cin>>tt;
    while(tt--) solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 2 ms 332 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 460 KB Output is correct
14 Correct 3 ms 440 KB Output is correct
15 Correct 3 ms 460 KB Output is correct
16 Correct 16 ms 332 KB Output is correct
17 Correct 14 ms 332 KB Output is correct
18 Correct 15 ms 476 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 518 ms 12612 KB Output is correct
2 Correct 459 ms 18288 KB Output is correct
3 Correct 454 ms 18132 KB Output is correct
4 Correct 520 ms 18348 KB Output is correct
5 Execution timed out 3007 ms 14280 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 615 ms 2976 KB Output is correct
2 Correct 1997 ms 2772 KB Output is correct
3 Execution timed out 3088 ms 2296 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 2 ms 332 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 460 KB Output is correct
14 Correct 3 ms 440 KB Output is correct
15 Correct 3 ms 460 KB Output is correct
16 Correct 16 ms 332 KB Output is correct
17 Correct 14 ms 332 KB Output is correct
18 Correct 15 ms 476 KB Output is correct
19 Correct 2503 ms 8120 KB Output is correct
20 Correct 2450 ms 8152 KB Output is correct
21 Execution timed out 3105 ms 5016 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 2 ms 332 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 460 KB Output is correct
14 Correct 3 ms 440 KB Output is correct
15 Correct 3 ms 460 KB Output is correct
16 Correct 16 ms 332 KB Output is correct
17 Correct 14 ms 332 KB Output is correct
18 Correct 15 ms 476 KB Output is correct
19 Correct 518 ms 12612 KB Output is correct
20 Correct 459 ms 18288 KB Output is correct
21 Correct 454 ms 18132 KB Output is correct
22 Correct 520 ms 18348 KB Output is correct
23 Execution timed out 3007 ms 14280 KB Time limit exceeded
24 Halted 0 ms 0 KB -