답안 #17717

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17717 2016-01-12T09:10:45 Z Adilkhan 돌 무게 재기 (IZhO11_stones) C++
8 / 100
80 ms 23220 KB
#include <bits/stdc++.h>

#define pb push_back
#define endl "\n"
#define mp make_pair 
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fname ""
#define sz(x) (int)(x.size())

typedef long long ll;

using namespace std;

const ll N = (ll)(5e5) + 322;
const ll INF = (ll)(1e9);
const ll mod = (ll)(1e9) + 7;
const double eps = 1e-9;

int n, x[N], y[N], q, s, sum, mn, mx;

int add[N];
pair <int, int> t[N * 4];

void push(int x, int l, int r) {
	if (add[x]) {
		t[x].fi += add[x];
		t[x].se += add[x];
		if (l != r) {
			add[x + x] = add[x];
			add[x + x + 1] = add[x];
		}
		add[x] = 0;
	}			
}

void upd(int x, int tl, int tr, int l, int r, int val) {
	push(x, tl, tr);
	if (l <= tl && tr <= r) {
		add[x] += val;
		push(x, tl, tr);
		return;	
	}
	if (tl > r || tr < l) {
		return;		                  	
	}
	int mid = (tl + tr) / 2;
	upd(x + x, tl, mid, l, r, val);
	upd(x + x + 1, mid + 1, tr, l, r, val);
	t[x].fi = max(t[x + x].fi, t[x + x + 1].fi);
	t[x].se = min(t[x + x].se, t[x + x + 1].se);
}


int main () {
	//freopen(fname".in", "r", stdin);
	//freopen(fname".out", "w", stdout);
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d%d", &q, &s);
		if (s == 1) {
			upd(1, 1, n, 1, q, 1);
		}else {  
			upd(1, 1, n, 1, q, -1);
		}       
		mx = t[1].fi;                       
		mn = t[1].se;
		if (mn < 0 && mx > 0) {
	  	puts("?");
		}
		if (mn >= 0 && mx >= 0) {
			puts(">");
		}
		if (mn <= 0 && mx <= 0) {
			puts("<");
		}
	}
	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 23220 KB Output isn't correct - 10th words differ - expected: '<', found: '?'
2 Incorrect 5 ms 23220 KB Output isn't correct - 4th words differ - expected: '>', found: '?'
3 Incorrect 5 ms 23220 KB Output isn't correct - 3rd words differ - expected: '?', found: '<'
4 Incorrect 0 ms 23220 KB Output isn't correct - 16th words differ - expected: '<', found: '?'
5 Incorrect 5 ms 23220 KB Output isn't correct - 8th words differ - expected: '<', found: '?'
6 Incorrect 0 ms 23220 KB Output isn't correct - 6th words differ - expected: '<', found: '?'
7 Incorrect 6 ms 23220 KB Output isn't correct - 6th words differ - expected: '<', found: '?'
8 Incorrect 3 ms 23220 KB Output isn't correct - 13th words differ - expected: '?', found: '>'
9 Incorrect 2 ms 23220 KB Output isn't correct - 6th words differ - expected: '>', found: '?'
10 Incorrect 3 ms 23220 KB Output isn't correct - 6th words differ - expected: '<', found: '?'
11 Incorrect 43 ms 23220 KB Output isn't correct - 3rd words differ - expected: '<', found: '?'
12 Incorrect 80 ms 23220 KB Output isn't correct - 25193rd words differ - expected: '<', found: '?'
13 Correct 72 ms 23220 KB Output is correct - 100000 tokens
14 Correct 78 ms 23220 KB Output is correct - 100000 tokens
15 Incorrect 72 ms 23220 KB Output isn't correct - 6th words differ - expected: '<', found: '?'
16 Incorrect 67 ms 23220 KB Output isn't correct - 10th words differ - expected: '>', found: '?'
17 Incorrect 77 ms 23220 KB Output isn't correct - 4th words differ - expected: '>', found: '?'
18 Incorrect 70 ms 23220 KB Output isn't correct - 12th words differ - expected: '<', found: '?'
19 Incorrect 63 ms 23220 KB Output isn't correct - 5th words differ - expected: '<', found: '?'
20 Incorrect 69 ms 23220 KB Output isn't correct - 5th words differ - expected: '<', found: '?'
21 Incorrect 77 ms 23220 KB Output isn't correct - 6th words differ - expected: '>', found: '?'
22 Incorrect 74 ms 23220 KB Output isn't correct - 8th words differ - expected: '>', found: '?'
23 Incorrect 71 ms 23220 KB Output isn't correct - 6th words differ - expected: '>', found: '?'
24 Incorrect 66 ms 23220 KB Output isn't correct - 12th words differ - expected: '<', found: '?'
25 Incorrect 67 ms 23220 KB Output isn't correct - 10th words differ - expected: '>', found: '?'