/**
____ ____ ____ ____ ____ ____
||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;
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 |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Execution timed out |
2079 ms |
4044 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |