답안 #166212

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
166212 2019-12-01T08:22:33 Z Dovran 돌 무게 재기 (IZhO11_stones) C++11
0 / 100
1000 ms 880 KB
#include <bits/stdc++.h>
#define N 100009
#define pii pair <int, int>
#define ff first
#define ss second
#define pb push_back
#define ll long long

using namespace std;

int n, v[N], c[N];
vector<int>a, b;
int r, l;

int main(){
	cin>>n;
	for(int i=1; i<=n; i++){
		int x, y;
		cin>>x>>y;
		if(y==1){
			a.pb(x), l=max(l, x);
			for(int j=x; j>=1; j--)
				c[j]--;
		}
		else{
			b.pb(x), r=max(r, x);
			for(int j=x; j>=1; j--)
				c[j]++;
		}
		
		int mn=1e9, mx=0;
		for(int j=n; j>=1; j--){
			mn=min(mn, c[j]);
			mx=max(mx, c[j]);
		}
		if(l>r and mx<=0)
			cout<<">\n";
		else if(r>l and mn>=0)
			cout<<"<\n";
		else
			cout<<"?\n";
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 8 ms 376 KB Output is correct
9 Correct 9 ms 376 KB Output is correct
10 Correct 136 ms 488 KB Output is correct
11 Execution timed out 1067 ms 880 KB Time limit exceeded
12 Halted 0 ms 0 KB -