제출 #817694

#제출 시각아이디문제언어결과실행 시간메모리
817694MeloricMonkey and Apple-trees (IZhO12_apple)C++14
100 / 100
62 ms1032 KiB
#include <bits/stdc++.h> #define pb push_back #define int int64_t #define pii pair<int, int> #define X first #define Y second #define all(x) (x).begin(),(x).end() #define lb lower_bound #define ub upper_bound using namespace std; const int inf = 1e18; void p(auto A){ for(auto e : A)cout << e << ' '; cout << '\n'; } const int MAXM = 100000, MAXN = 1e9+5; array<int, MAXM*70> VAL, LC, RC; int node = 0; void upd(int& u, int tl, int tr, int l, int r){ if(tl > r || tr < l)return; if(VAL[u])return; if(!u)u=++node; if(tl >= l && tr <= r)return VAL[u]=1, void(); int tm = (tl+tr)/2; upd(LC[u], tl, tm, l, r); upd(RC[u], tm+1, tr, l, r); } int qer(int u, int tl, int tr, int l, int r){ if(!u)return 0; if(tl > r || tr < l)return 0; if(VAL[u])return min(r, tr) - max(l, tl) + 1; int tm = (tl+tr)/2; return qer(LC[u], tl, tm, l, r) + qer(RC[u], tm+1, tr, l, r); } void solve(){ int m; cin >> m; int C=0; int root=0; for(int i = 0; i< m; i++){ int d, x, y; cin >> d >> x >> y; x+=C; y+=C; if(d==1){ C=qer(root, 0, MAXN, x, y); cout << C << '\n'; }else{ upd(root, 0, MAXN, x, y); } } } signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; //cin >> t; while(t--)solve(); }

컴파일 시 표준 에러 (stderr) 메시지

apple.cpp:15:8: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   15 | void p(auto A){
      |        ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...