Submission #547354

#TimeUsernameProblemLanguageResultExecution timeMemory
547354danikoynovMonkey and Apple-trees (IZhO12_apple)C++14
0 / 100
0 ms212 KiB
/** ____ ____ ____ ____ ____ ____ ||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 timeMemoryGrader output
Fetching results...