답안 #1071393

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071393 2024-08-23T07:08:13 Z vjudge1 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
3000 ms 31364 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define pb push_back
#define sz(x) x.size()
#define nl '\n'
#define F first
#define S second

const int N = 1e6 + 1;
const int inf = 1e18;

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, q;
    cin >>n >>q;
    int a[n + 1];
    for( int i = 1; i <= n; ++i )
        cin >>a[i];
    while( q-- )
    {
        int l, r, k;
        bool ch = false;
        cin >>l >>r >>k;
        vector< int >v;
        v.pb(0);
        for( int i = l; i <= r; ++i )
            v.pb( a[i] );
        int p[r - l + 2];
        p[0] = 0;
        for( int i = 1; i < sz(v); ++i )
        {
            p[i] = max(p[i - 1], v[i]);
            if( i > 0 && p[i - 1] > v[i] && p[i - 1] + v[i] > k )
                ch = true;
        }
        cout <<(ch ? 0 : 1) <<nl;
    }
}

Compilation message

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:35:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for( int i = 1; i < sz(v); ++i )
      |                           ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 456 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 456 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 5 ms 348 KB Output is correct
12 Correct 20 ms 604 KB Output is correct
13 Correct 24 ms 720 KB Output is correct
14 Correct 39 ms 604 KB Output is correct
15 Correct 46 ms 776 KB Output is correct
16 Correct 99 ms 600 KB Output is correct
17 Correct 81 ms 604 KB Output is correct
18 Correct 85 ms 684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3054 ms 31364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3022 ms 3836 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 456 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 5 ms 348 KB Output is correct
12 Correct 20 ms 604 KB Output is correct
13 Correct 24 ms 720 KB Output is correct
14 Correct 39 ms 604 KB Output is correct
15 Correct 46 ms 776 KB Output is correct
16 Correct 99 ms 600 KB Output is correct
17 Correct 81 ms 604 KB Output is correct
18 Correct 85 ms 684 KB Output is correct
19 Execution timed out 3066 ms 8908 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 456 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 5 ms 348 KB Output is correct
12 Correct 20 ms 604 KB Output is correct
13 Correct 24 ms 720 KB Output is correct
14 Correct 39 ms 604 KB Output is correct
15 Correct 46 ms 776 KB Output is correct
16 Correct 99 ms 600 KB Output is correct
17 Correct 81 ms 604 KB Output is correct
18 Correct 85 ms 684 KB Output is correct
19 Execution timed out 3054 ms 31364 KB Time limit exceeded
20 Halted 0 ms 0 KB -