답안 #17883

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17883 2016-01-13T05:22:20 Z Erzhann 돌 무게 재기 (IZhO11_stones) C++
0 / 100
0 ms 8752 KB
/*
  /\     /\
  | ).|.( |
  |  >-<  |
  =========
It's AdilkhanKo miaaaaaau      
*/
#include<bits/stdc++.h>

#define ll long long
#define pb push_back
#define endl "\n"
#define foreach(it, S) for(__typeof (S.begin()) it = S.begin(); it != S.end(); it++)
#define mp make_pair
#define f first
#define s second 
#define name ""
#define _ ios_base::sync_with_stdio(false);cin.tie(0);

using namespace std;
                                            
const int MaxN = int (2e5) + 256;
const int INF = int(1e9);  
const int mod = (int)(1e9) + 7;
int n, a[MaxN], m;
pair<int, int> t[4 * MaxN];

void push(int v, int l, int r){
	if(a[v]){
		t[v].first += a[v];
		t[v].second += a[v];
		if(l != r)
			a[v + v] = a[v + v + 1] = a[v];
		a[v] = 0;
	}
}
void upd(int v, int l, int r, int tl, int tr, int val){
	push(v, l, r);
	if(tl <= l && r <= tr){
		a[v] += val;
		push(v, l, r);
		return;
	}
	if(l > tr || r < tl)
		return;
	int m = (l + r) / 2;
	upd(v + v, l, m, tl, tr, val);
	upd(v + v + 1, m + 1, r, tl, tr, val);
	t[v].first = max(t[v + v].first, t[v + v + 1].first);
	t[v].second = min(t[v + v].second, t[v + v + 1].second);
}
int main () { _
/*	#ifdef ONLINE_JUDGE
		freopen (name".in","r",stdin);
		freopen (name".out","w",stdout);
	#else
		freopen (".in","r",stdin);
		freopen (".out","w",stdout);
	#endif */
	cin >> n;
	for(int i = 1; i <= n; i++){
		int x, y; cin >> x >> y;
		if(y == 1){
			upd(1, 1, n, 1, x, 1);
		}else{
			upd(1, 1, n, 1, x, -1);
		}
		int mx = t[1].first;
		int mn = t[1].second;
		cerr << mx << " " << mn << endl;
		if(mn >= 0 && mx >= 0){
			cout << ">" << endl;
		}else if(mx <= 0){
			cout << "<" << endl;
		}else cout << "?" << endl;
	}                       	
return 0;
}                   									
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 8752 KB Output isn't correct - 10th words differ - expected: '<', found: '?'
2 Incorrect 0 ms 8752 KB Output isn't correct - 4th words differ - expected: '>', found: '?'
3 Incorrect 0 ms 8752 KB Output isn't correct - 3rd words differ - expected: '?', found: '<'
4 Incorrect 0 ms 8752 KB Output isn't correct - 16th words differ - expected: '<', found: '?'
5 Incorrect 0 ms 8752 KB Output isn't correct - 8th words differ - expected: '<', found: '?'
6 Incorrect 0 ms 8752 KB Output isn't correct - wrong output format : File not found: "/var/www/temp/17883/outputEJy1_1"
7 Halted 0 ms 0 KB
8 Halted 0 ms 0 KB
9 Halted 0 ms 0 KB
10 Halted 0 ms 0 KB
11 Halted 0 ms 0 KB
12 Halted 0 ms 0 KB
13 Halted 0 ms 0 KB
14 Halted 0 ms 0 KB
15 Halted 0 ms 0 KB
16 Halted 0 ms 0 KB
17 Halted 0 ms 0 KB
18 Halted 0 ms 0 KB
19 Halted 0 ms 0 KB
20 Halted 0 ms 0 KB
21 Halted 0 ms 0 KB
22 Halted 0 ms 0 KB
23 Halted 0 ms 0 KB
24 Halted 0 ms 0 KB
25 Halted 0 ms 0 KB