# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1232815 | _Knyaz_ | 원숭이와 사과 나무 (IZhO12_apple) | C++20 | 2094 ms | 560 KiB |
///Bismillahir Rohmanir Rohim
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define sc second
#define int int64_t
#define ll __uint128_t
#define sz(x) long((x).size())
#define all(x) (x).begin(), (x).end()
const int mod = 1e9+7;
const double PI = acos( -1. );
void in(){
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
}
void solve(){
int M, C = 0; cin >> M;
vector<bool> vec(1000010, 0);
for(int i = 0; i < M; i++){
int D, X, Y; cin >> D >> X >> Y;
if(D == 1){
int cnt = 0;
for(int j = X + C; j <= Y + C; j++) cnt += (vec[j]);
C = cnt;
cout << C << '\n';
}
if(D == 2){
for(int j = X + C; j <= Y + C; j++) vec[j] = 1;
}
}
}
signed main(){
//in();
cin.tie(0)->sync_with_stdio(0);
int t; t = 1;
//cin >> t;
while(t--) solve();
}
/*
██╗ ██╗███╗ ██╗██╗ ██╗ █████╗ ███████╗
██║ ██╔╝████╗ ██║╚██╗ ██╔╝██╔══██╗╚══███╔╝
█████╔╝ ██╔██╗ ██║ ╚████╔╝ ███████║ ███╔╝
██╔═██╗ ██║╚██╗██║ ╚██╔╝ ██╔══██║ ███╔╝
███████╗██║ ██╗██║ ╚████║ ██║ ██║ ██║███████╗███████╗
╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝
*/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |