Submission #124458

#TimeUsernameProblemLanguageResultExecution timeMemory
124458MtaylorWorst Reporter 3 (JOI18_worst_reporter3)C++14
0 / 100
1612 ms11116 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vl ; #define mp make_pair #define pb push_back #define f first #define s second #define all(v) (v).begin(),(v).end() const int MOD = 1000000007; const int N = 1000005; const double PI =4*atan(1); const double eps = 1e-7; ll n,q; ll d[N]; ll l, r, t; int main(){ ios::sync_with_stdio(0); //freopen("easy.txt","r",stdin); cin >> n>> q; for(int i=0;i<n;i++){ cin >> d[i]; } while(q--){ cin >> t >> l>> r; ll a=t; l=max(l,a-2*(n)); r=min(r,a); if(l>r){ cout << 0 << endl; continue; } ll pairs=0; ll impairs=0; pairs= r/2-(l-1)/2; impairs = (r-1)/2 - (l-2)/2; //cout << l << " " << r << endl; //cout << pairs << " " << impairs << endl; if(a%2==0){ cout << pairs << endl; }else{ cout << impairs << endl; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...