Submission #1256457

#TimeUsernameProblemLanguageResultExecution timeMemory
1256457WhisperHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
0 / 100
3095 ms4168 KiB
#include <bits/stdc++.h>
using namespace std;

signed main(){
    #define name "Whisper"
    cin.tie(nullptr) -> sync_with_stdio(false); cout.tie(nullptr);
    if(fopen(name".inp", "r")){
        freopen(name".inp", "r", stdin);
        freopen(name".out", "w", stdout);
    }
    int nArr, numQuery; cin >> nArr >> numQuery;
    vector<int> A(nArr + 5);
    for (int i = 1; i <= nArr; ++i) cin >> A[i];
    for (int i = 1; i <= numQuery; ++i){
        int l, r, k; cin >> l >> r >> k;
        bool ok = 1;
        for (int j = l; j <= r; ++j){
            int mx = 0;
            for (int x = l; x < j; ++x){
                if(A[x] > A[j]) mx = max(mx, A[x]);
            }
            ok &= (mx + A[j] <= k);
        }
        cout << ok << '\n';
    }
    return (0 ^ 0);
}





Compilation message (stderr)

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