# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
547354 | danikoynov | Monkey and Apple-trees (IZhO12_apple) | C++14 | 0 ms | 212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
____ ____ ____ ____ ____ ____
||l |||e |||i |||n |||a |||d ||
||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|
**/
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
void speed()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
const int maxn = 1e7 + 10;
int m, c, a[maxn];
void solve()
{
cin >> m;
if (m > 100)
while(true);
for (int i = 1; i <= m; i ++)
{
int d, x, y;
cin >> d >> x >> y;
x += c;
y += c;
if (d == 1)
{
int ans = 0;
for (int j = x; j <= y; j ++)
ans = ans + a[j];
cout << ans << endl;
c += ans;
}
else
{
for (int j = x; j <= y; j ++)
a[j] = 1;
}
}
}
int main()
{
solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |