#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 time |
Memory |
Grader output |
1 |
Incorrect |
1612 ms |
11116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1612 ms |
11116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |