답안 #17885

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17885 2016-01-13T05:28:43 Z Erzhann 돌 무게 재기 (IZhO11_stones) C++
0 / 100
5 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;
		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 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 - 6th words differ - expected: '<', found: '?'
7 Incorrect 2 ms 8752 KB Output isn't correct - 6th words differ - expected: '<', found: '?'
8 Incorrect 0 ms 8752 KB Output isn't correct - 13th words differ - expected: '?', found: '>'
9 Incorrect 3 ms 8752 KB Output isn't correct - 6th words differ - expected: '>', found: '?'
10 Runtime error 2 ms 8752 KB writev (syscall #20) was called by the program (disallowed syscall)
11 Runtime error 5 ms 8752 KB writev (syscall #20) was called by the program (disallowed syscall)
12 Runtime error 2 ms 8752 KB SIGSEGV Segmentation fault
13 Runtime error 0 ms 8752 KB writev (syscall #20) was called by the program (disallowed syscall)
14 Runtime error 4 ms 8752 KB writev (syscall #20) was called by the program (disallowed syscall)
15 Runtime error 3 ms 8752 KB writev (syscall #20) was called by the program (disallowed syscall)
16 Runtime error 2 ms 8752 KB writev (syscall #20) was called by the program (disallowed syscall)
17 Runtime error 2 ms 8752 KB SIGSEGV Segmentation fault
18 Runtime error 0 ms 8752 KB SIGSEGV Segmentation fault
19 Runtime error 0 ms 8752 KB SIGSEGV Segmentation fault
20 Runtime error 0 ms 8752 KB SIGSEGV Segmentation fault
21 Runtime error 0 ms 8752 KB SIGSEGV Segmentation fault
22 Runtime error 2 ms 8752 KB SIGSEGV Segmentation fault
23 Runtime error 2 ms 8752 KB SIGSEGV Segmentation fault
24 Runtime error 0 ms 8752 KB SIGSEGV Segmentation fault
25 Runtime error 0 ms 8752 KB SIGSEGV Segmentation fault