Submission #1256455

#TimeUsernameProblemLanguageResultExecution timeMemory
1256455WhisperHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
8 / 100
3094 ms4164 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;
        int mx = 0;
        for (int j = l; j <= r; ++j){
            for (int x = l; x < j; ++x){
                if(A[x] > A[j]) mx = max(mx, A[j] + A[x]);
            }
        }
        cout << (mx <= k) << '\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...