답안 #948133

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
948133 2024-03-17T15:54:46 Z nguyennh 원숭이와 사과 나무 (IZhO12_apple) C++14
0 / 100
2000 ms 4448 KB
#include<bits/stdc++.h>
#define el '\n'
using namespace std ;

mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());

const int MN = 1e6 + 10;

int32_t main (){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int m;
  cin >> m;
  vector<int> a(MN , 0);
  int64_t last = 0;
  for ( int i = 1 ; i <= m ; i++ ){
    int64_t type , l , r;
    cin >> type >> l >> r;
    l += last;
    r += last;
    if (type == 1){
      int ans = 0;
      for ( int i = l ; i <= r ; i++ ) ans += a[i];
      last = ans;
      cout << last << el;
    }
    else {
      for ( int i = l ; i <= r ; i++ ) a[i] = 1;
    }
  }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4184 KB Output is correct
2 Correct 2 ms 4188 KB Output is correct
3 Correct 1 ms 4188 KB Output is correct
4 Correct 1750 ms 4448 KB Output is correct
5 Execution timed out 2072 ms 4436 KB Time limit exceeded
6 Halted 0 ms 0 KB -