답안 #17693

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17693 2016-01-12T08:42:47 Z Adilkhan 돌 무게 재기 (IZhO11_stones) C++
0 / 100
11 ms 44708 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;

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

ll add[N];
pair <ll, ll> 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 () {
	ios_base :: sync_with_stdio (false); cin.tie(0);
	//freopen(fname".in", "r", stdin);
	//freopen(fname".out", "w", stdout);
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> 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) {
			cout << '?' << endl;
		}
		if (mn >= 0 && mx >= 0) {
			cout << '>' << endl;
		}
		if (mn <= 0 && mx <= 0) {
			cout << '<' << endl;
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 44708 KB Output isn't correct - 10th words differ - expected: '<', found: '?'
2 Incorrect 4 ms 44708 KB Output isn't correct - 4th words differ - expected: '>', found: '?'
3 Incorrect 4 ms 44708 KB Output isn't correct - 3rd words differ - expected: '?', found: '<'
4 Incorrect 0 ms 44708 KB Output isn't correct - 16th words differ - expected: '<', found: '?'
5 Incorrect 4 ms 44708 KB Output isn't correct - 8th words differ - expected: '<', found: '?'
6 Incorrect 0 ms 44708 KB Output isn't correct - 6th words differ - expected: '<', found: '?'
7 Incorrect 8 ms 44708 KB Output isn't correct - 6th words differ - expected: '<', found: '?'
8 Incorrect 8 ms 44708 KB Output isn't correct - 13th words differ - expected: '?', found: '>'
9 Incorrect 0 ms 44708 KB Output isn't correct - 6th words differ - expected: '>', found: '?'
10 Runtime error 11 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
11 Runtime error 7 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
12 Runtime error 11 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
13 Runtime error 3 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
14 Runtime error 4 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
15 Runtime error 7 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
16 Runtime error 3 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
17 Runtime error 3 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
18 Runtime error 3 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
19 Runtime error 10 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
20 Runtime error 10 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
21 Runtime error 3 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
22 Runtime error 7 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
23 Runtime error 10 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
24 Runtime error 0 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)
25 Runtime error 3 ms 44708 KB writev (syscall #20) was called by the program (disallowed syscall)