This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int NMAX = 500*1000;
int distanceNec[NMAX];
int posPersonne[NMAX];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int nbPersonnes, nbRequetes;
cin >> nbPersonnes >> nbRequetes;
bool tout1 = true;
for(int iP = 0; iP < nbPersonnes; iP++)
{
cin >> distanceNec[iP];
if(distanceNec[iP] != 1) tout1 = false;
posPersonne[iP] = -(iP+1);
}
if(tout1)
{
int deb = -nbPersonnes;
int fin = 0;
int a, b;
int j;
for(int iQ = 0; iQ < nbRequetes; iQ++)
{
cin >> j >> a >> b;
a = max(a, deb+j);
b = min(b, fin + j);
// cout << a << " " << b << endl;
if(a > b) cout << "0" << "\n";
else cout << (b-a+1) << "\n";
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |