# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
681008 | Cutebol | Weighting stones (IZhO11_stones) | C++17 | 71 ms | 7456 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
#define Raiden ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0);
#define int long long
#define itn int
#define endl "\n"
#define ff first
#define ss second
const int N = 2e5 + 5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e9 ;
int n ;
int lz[4*N] , mn[4*N] , mx[N*4] ;
void push( int l , int r , int v ){
if ( lz[v] ){
mn[v] += lz[v] ;
mx[v] += lz[v] ;
if ( l != r ){
lz[v+v] += lz[v] ;
lz[v+v+1] += lz[v] ;
}
lz[v] = 0 ;
}
}
void upd ( int l , int r , int v , int tl = 1 , int tr = n , int x = 1 ){
// cout << tl << ' ' << tr << ' ' << x << endl ;
push( tl , tr , x ) ;
if ( tr < l || tl > r ) return ;
if ( tr <= r && tl >= l ){
lz[x] += v ;
push( tl , tr , x ) ;
return ;
}
int mid = ( tl + tr ) / 2 ;
upd( l , r , v , tl , mid , x + x ) ;
upd( l , r , v , mid + 1 , tr , x + x + 1 ) ;
mn[x] = min ( mn[x+x] , mn[x+x+1] ) ;
mx[x] = max ( mx[x+x] , mx[x+x+1] ) ;
}
void solve(){
cin >> n ;
for ( int i = 0 ; i < n ; i ++ ){
int a , b , s = 1 ;
cin >> a >> b ;
if ( b == 2 ) s = -1 ;
upd( 1 , a , s ) ;
if ( mn[1] >= 0 && mx[1] > 0 ) cout << ">\n" ;
else if ( mn[1] < 0 && mx[1] <= 0 ) cout << "<\n" ;
else cout << "?\n" ;
}
}
signed main(){
// fopn("blocks") ;
Raiden ;
int t = 1 ;
// cin >> t ;
while ( t -- ) solve() ;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |