Submission #166790

#TimeUsernameProblemLanguageResultExecution timeMemory
166790DovranWeighting stones (IZhO11_stones)C++11
0 / 100
35 ms1320 KiB
#include <bits/stdc++.h> #define pb push_back #define ss second #define ff first #define N 100005 #define inf 1000000009 #define ll long long #define mid(a,b) (a+b)/2 using namespace std; int n,T[N][3],T1[N][3],mx,mt,t,r; void upd(int v,int pos,int l,int r,int nd){ T[nd][1] += T[nd / 2][2]; T1[nd][1] += T1[nd / 2][2]; T[nd][2] += T[nd / 2][2]; T1[nd][2] += T1[nd / 2][2]; if(r <= pos){ T[nd][1] += v; T[nd][2] += v; T1[nd][1] += v; T1[nd][2] += v; return; } if(l <= pos){ upd(v,pos,l,mid(l,r),nd * 2); upd(v,pos,mid(l,r)+1,r,nd*2+1); T[nd][2] = 0; T1[nd][2] = 0; T[nd][1] = max(T[nd * 2][1],T[nd * 2 + 1][1]); T1[nd][1] = min(T1[nd * 2][1],T1[nd * 2 + 1][1]); } } int main() { cin>>n; for(int i = 1;i <= n;i++){ cin >> r >> t; if(r > mx){ mx = r; mt = t; } if(t == 1) upd(-1,r,1,n,1); else upd(1,r,1,n,1); if(mt == 1) if(T[1][1] <= 0) cout << ">\n"; else cout << "?\n"; else { if(T1[1][1] >= 0) cout << "<\n"; else cout << "?\n"; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...