Submission #17685

# Submission time Handle Problem Language Result Execution time Memory
17685 2016-01-12T08:11:34 Z Adilkhan Weighting stones (IZhO11_stones) C++
36 / 100
1000 ms 10676 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;

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) {
			x[q]++;
		}else {
			x[q]--;
		}            
		sum = 0;
		vector <int> v;
		for (int j = n; j >= 1; --j) {
			sum += x[j];
			v.pb(sum);
		}
		sort(all(v));
		mx = v[sz(v) - 1];                       
		mn = v[0];
		if (mn < 0 && mx > 0) {
			cout << '?' << endl;
		}
		if (mn >= 0 && mx >= 0) {
			cout << '>' << endl;
		}
		if (mn <= 0 && mx <= 0) {
			cout << '<' << endl;
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 9532 KB Output is correct - 73 tokens
2 Correct 0 ms 9532 KB Output is correct - 89 tokens
3 Correct 0 ms 9532 KB Output is correct - 221 tokens
4 Correct 0 ms 9532 KB Output is correct - 21 tokens
5 Correct 4 ms 9532 KB Output is correct - 369 tokens
6 Correct 7 ms 9532 KB Output is correct - 492 tokens
7 Correct 21 ms 9532 KB Output is correct - 945 tokens
8 Correct 41 ms 9668 KB Output is correct - 1237 tokens
9 Correct 30 ms 9668 KB Output is correct - 1105 tokens
10 Runtime error 903 ms 9668 KB writev (syscall #20) was called by the program (disallowed syscall)
11 Execution timed out 1000 ms 10164 KB Program timed out
12 Execution timed out 1000 ms 10676 KB Program timed out
13 Execution timed out 1000 ms 10676 KB Program timed out
14 Execution timed out 1000 ms 10676 KB Program timed out
15 Execution timed out 1000 ms 10676 KB Program timed out
16 Execution timed out 1000 ms 10676 KB Program timed out
17 Execution timed out 1000 ms 10676 KB Program timed out
18 Execution timed out 1000 ms 0 KB Program timed out
19 Execution timed out 1000 ms 10676 KB Program timed out
20 Execution timed out 1000 ms 10676 KB Program timed out
21 Execution timed out 1000 ms 10676 KB Program timed out
22 Execution timed out 1000 ms 10676 KB Program timed out
23 Execution timed out 1000 ms 10676 KB Program timed out
24 Execution timed out 1000 ms 10676 KB Program timed out
25 Execution timed out 1000 ms 10676 KB Program timed out