Submission #547355

# Submission time Handle Problem Language Result Execution time Memory
547355 2022-04-10T13:57:42 Z danikoynov Monkey and Apple-trees (IZhO12_apple) C++14
0 / 100
1 ms 212 KB
/**
 ____ ____ ____ ____ ____ ____
||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 > 10)
        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
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -