Submission #39698

# Submission time Handle Problem Language Result Execution time Memory
39698 2018-01-17T11:45:14 Z b00n0rp Weighting stones (IZhO11_stones) C++14
0 / 100
0 ms 11388 KB
/*input
5
1 2
3 1
2 1
4 2
5 1
*/		
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define int ll
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define WL(t) while(t --)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;

int power(int a,int b,int m = MOD){
	if(b == 0) return 1;
	if(b == 1) return a;
	int x = power(a,b/2,m)%m;
	x = (x*x)%m;
	if(b%2) return (x*a)%m;
	return x;
}

struct node{
	int lazy,mx,mn;
};

int n;
node seg[400005];

void push(int node,int xl,int xr){
	if(!seg[node].lazy) return;
	seg[node].mx += seg[node].lazy;
	seg[node].mn += seg[node].lazy;
	if(xl == xr) return;
	seg[2*node].lazy += seg[node].lazy;
	seg[2*node+1].lazy += seg[node].lazy;
	seg[node].lazy = 0;
}

void upd(int node,int xl,int xr,int l,int r,int val){
	// cout << node << " " << xl << " " << xr << " " << l << " " << r << " " << val << endl;
	if(xl > r or xr < l or xr < xl) return ;
	if(l <= xl and xr <= r){
		seg[node].lazy += val;
		push(node,xl,xr);
		return;
	}
	push(node,xl,xr);
	int mid = (xl+xr)/2;
	upd(2*node,xl,mid,l,r,val);
	upd(2*node+1,mid+1,xr,l,r,val);
	seg[node].mn = min(seg[2*node].mn,seg[2*node+1].mn);
	seg[node].mx = max(seg[2*node].mx,seg[2*node+1].mx);
}

signed main(){
	// ios_base::sync_with_stdio(false);
	// cin.tie(0);
	// cout.tie(0);

	// REP(i,400005){
	// 	seg[i] = {0,-1,1};
	// }

	cin >> n;
	REP(i,n){
		int r,s; cin >> r >> s;
		if(s == 2) s = -1;
		upd(1,1,n,1,r,s);
		// cout << seg[1].mx << " " << seg[1].mn << endl;
		if(seg[1].mx <= 0) cout << "<\n";
		else if(seg[1].mn >= 0) cout << ">\n";
		else cout << "?\n";
	}
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 11388 KB Output is correct
2 Correct 0 ms 11388 KB Output is correct
3 Correct 0 ms 11388 KB Output is correct
4 Incorrect 0 ms 11388 KB Output isn't correct
5 Halted 0 ms 0 KB -