Code Submission Evaluation System Login

HIIT Open 2018

Start:2018-05-26 11:00:00
End:2018-05-26 16:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - HIIT Open 2018 - Results
History
2018-05-26 11:58:43
2018-05-26 11:51:54
Task:Coins
Sender:Karhukopla
Submission time:2018-05-26 11:58:43
Language:C++
Status:READY
Result:ACCEPTED

Test results

testverdicttime (s)
#1ACCEPTED0.34 / 1.00details
#2ACCEPTED0.35 / 1.00details
#3ACCEPTED0.36 / 1.00details
#4ACCEPTED0.39 / 1.00details
#5ACCEPTED0.38 / 1.00details

Code

#include <bits/stdc++.h>

#define ll long long
#define lll __int128
#define pii pair<int, int>
#define M 1000000007
#define N (1<<18)
using namespace std;

int mx[2*N];
int mn[2*N];
int s[2*N];

void setv (int k, int n) {
	k += N;
	s[k] = mn[k] = mx[k] = n;
	for (k /= 2; k >= 1; k /= 2) {
		s[k] = s[2 * k] + s[2 * k + 1];
		mn[k] = min(min(mn[2 * k], s[2 * k] + mn[2 * k + 1]), s[2 * k]);
		mx[k] = max(max(mx[2 * k], s[2 * k] + mx[2 * k + 1]), s[2 * k]);
	}
}

int main () {
	int n;
	cin>>n;
	while (n --> 0) {
		int c, s;
		cin>>c>>s;
		if (s == 2) s = -1;
		setv(N - c, s);
		char ans = '-';
		if (mn[1] < 0) ans = '<';
		if (mx[1] > 0) {
			if (ans == '<') ans = '?';
			else ans = '>';
		}
		cout<<ans<<endl;
	}
}

Test details

Test 1

Verdict: ACCEPTED

input
200000
175878 1
146174 1
4939 2
181388 1
27963 2
28393 1
101955 2
129380 1
53446 1
56883 2
41641 2
52574 1
185690 2
17672 2
187 2
29223 1
116434 2
81263 2
153912 2
...
view   save

correct output
>
>
>
>
>
>
>
>
>
>
>
>
?
?
?
?
?
?
?
?
...
view   save

user output
>
>
>
>
>
>
>
>
>
>
>
>
?
?
?
?
?
?
?
?
...
view   save

Test 2

Verdict: ACCEPTED

input
200000
1 2
2 1
3 2
4 1
5 2
6 1
7 2
8 1
9 2
10 1
11 2
12 1
13 2
14 1
15 2
16 1
17 2
18 1
19 2
...
view   save

correct output
<
>
<
>
<
>
<
>
<
>
<
>
<
>
<
>
<
>
<
>
...
view   save

user output
<
>
<
>
<
>
<
>
<
>
<
>
<
>
<
>
<
>
<
>
...
view   save

Test 3

Verdict: ACCEPTED

input
200000
1 1
2 1
3 1
4 1
5 1
6 2
7 2
8 2
9 2
10 2
11 1
12 1
13 1
14 1
15 1
16 2
17 2
18 2
19 2
...
view   save

correct output
>
>
>
>
>
?
?
?
?
<
?
?
?
?
>
?
?
?
?
<
...
view   save

user output
>
>
>
>
>
?
?
?
?
<
?
?
?
?
>
?
?
?
?
<
...
view   save

Test 4

Verdict: ACCEPTED

input
200000
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
...
view   save

correct output
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
...
view   save

user output
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
...
view   save

Test 5

Verdict: ACCEPTED

input
200000
188909 2
58944 1
26824 1
143263 2
108129 2
170746 1
129857 2
151652 1
92616 1
5122 1
85017 2
133713 2
130510 1
23167 2
55879 2
81852 1
117028 1
185678 1
5335 2
...
view   save

correct output
<
<
?
<
<
<
<
?
?
?
?
?
?
?
?
?
?
?
?
?
...
view   save

user output
<
<
?
<
<
<
<
?
?
?
?
?
?
?
?
?
?
?
?
?
...
view   save