Submission #335828

#TimeUsernameProblemLanguageResultExecution timeMemory
335828tengiz05Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
0 / 100
3082 ms5996 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define all(x) (x).begin(), (x).end() #define pb push_back #define pii pair<int, int> #define ff first #define ss second #define PI acos(-1) #define ld long double const int mod = 1e9+7, N = 2e5+5; int msb(int val){return sizeof(int)*8-__builtin_clzll(val);} int a[N], n, m, k; void solve(int test_case){ int i, j, q; cin >> n >> q; for(i=1;i<=n;i++){ cin >> a[i]; } while(q--){ int l, r; bool is = true; cin >> l >> r >> k; for(;l<=r;l++){ int mx = -1; for(i=l+1;i<=r;i++){ if(a[i] != a[l] && a[i] < a[l])mx = a[i]; } if(mx != -1 && a[l]+mx > k){ is = false; } } if(is){ cout << 1 << '\n'; }else { cout << 0 << '\n'; } } return; } signed main(){ FASTIO; #define MULTITEST 0 #if MULTITEST int ___T; cin >> ___T; for(int T_CASE = 1; T_CASE <= ___T; T_CASE++) solve(T_CASE); #else solve(1); #endif return 0; }

Compilation message (stderr)

sortbooks.cpp: In function 'void solve(long long int)':
sortbooks.cpp:17:9: warning: unused variable 'j' [-Wunused-variable]
   17 |  int i, j, q;
      |         ^
#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...