제출 #1063216

#제출 시각아이디문제언어결과실행 시간메모리
1063216manhlinh1501Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
17 / 100
3078 ms14416 KiB
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const int MAXN = 1e6 + 5;

int N, Q;
int a[MAXN];

signed main() {
#define TASK "code"

    if (fopen(TASK ".inp", "r")) {
        freopen(TASK ".inp", "r", stdin);
        freopen(TASK ".out", "w", stdout);
    }

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> N >> Q;
    for(int i = 1; i <= N; i++) cin >> a[i];
    while(Q--) {
        int l, r, x;
        cin >> l >> r >> x;
        int res = 0;
        bool ok = true;
        for(int i = l; i <= r; i++) {
            if(res > a[i] and res + a[i] > x)
                ok = false;
            res = max(res, a[i]);
        }
        cout << ok << "\n";
    }
    return (0 ^ 0);
}

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

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:13:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         freopen(TASK ".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
sortbooks.cpp:14:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         freopen(TASK ".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#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...