제출 #1235997

#제출 시각아이디문제언어결과실행 시간메모리
1235997jungle15Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
34 / 100
3094 ms6220 KiB
#include <bits/stdc++.h>
using namespace std;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

#define Jungle "IZhO19_sortbooks"
#define MASK(i) (1 << (i))
#define getbit(x, i) (((x) >> (i)) & 1)
#define cntbit __builtin_popcount
#define MULTEST \
    int nq;     \
    cin >> nq;  \
    while(nq--)

template <typename t> void chkmin(t &a, t b) {
    if (a > b) a = b;
}

template <typename t> void chkmax(t &a, t b) {
    if (a < b) a = b;
}

int n, m, a[1000002];

void solve(void) {
    cin >> n >> m;
    for(int i = 1; i <= n; i++) cin >> a[i];
    for(int i = 1; i <= m; i++){
        bool check = 1;
        int l, r, k, ma = -1;
        cin >> l >> r >> k;
        for(int j = l; j <= r; j++) {
            chkmax(ma, a[j]);
            if(ma > a[j] && ma + a[j] > k){
                check = 0;
                break;
            }
        }
        cout << check << '\n';
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);

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

//    MULTEST
    solve();

    // cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

    return 0;
}

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

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