#include <bits/stdc++.h>
#define Fname ""
using namespace std;
const int MaxN = 3e5 + 17, INF = 1e9 + 17, Mod = 1e9 + 7;
multiset < int > S, s;
int n, x, y;
double Sx, Sy, Mx, My, kol1, kol2;
inline void Solve1 ()
{
int k1 = 0, k2 = 0;
auto i = s.rbegin ();
auto j = S.rbegin ();
for (int q = 1; q <= n; ++ q)
{
int X = *i;
int Y = *j;
if (Y > X)
k1 ++;
if (X > Y)
k2 ++;
if (k1 && k2)
{
puts ("?");
return;
}
if (X == 0 && Y == 0)
{
if (k2 == 0)
puts ("<");
else if (k1 == 0)
puts (">");
return;
}
++ i;
++ j;
}
}
int main ()
{
#ifdef Elibay
freopen (".in", "r", stdin);
#endif
cin >> n;
for (int i = 1; i <= n; ++ i)
S.insert (0), s.insert (0);
for (int z = 1; z <= n; ++ z)
{
cin >> x >> y;
if (y == 2)
{
Mx += x * 1.0 + 0.999, Sx += x * 1.0, kol2 ++;
auto w = S.begin ();
S.erase (w);
S.insert (x);
}
else if (y == 1)
{
My += x * 1.0 + 0.999, Sy += x * 1.0, kol1 ++;
auto w = s.begin ();
s.erase (s.begin ());
s.insert (x);
}
if (n <= int (3e3))
{
if ((Sx > My && kol2 >= kol1) || (Sy > Mx && kol1 >= kol2))
Solve1 ();
else
puts ("?");
}
else
{
if ((Sx > My && kol2 >= kol1))
puts ("<");
else if ((Sy > Mx && kol1 >= kol2))
puts (">");
else
puts ("?");
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1724 KB |
Output is correct - 73 tokens |
2 |
Correct |
0 ms |
1724 KB |
Output is correct - 89 tokens |
3 |
Correct |
0 ms |
1724 KB |
Output is correct - 221 tokens |
4 |
Correct |
0 ms |
1724 KB |
Output is correct - 21 tokens |
5 |
Correct |
0 ms |
1724 KB |
Output is correct - 369 tokens |
6 |
Correct |
5 ms |
1724 KB |
Output is correct - 492 tokens |
7 |
Correct |
0 ms |
1724 KB |
Output is correct - 945 tokens |
8 |
Correct |
8 ms |
1724 KB |
Output is correct - 1237 tokens |
9 |
Correct |
0 ms |
1724 KB |
Output is correct - 1105 tokens |
10 |
Incorrect |
34 ms |
2516 KB |
Output isn't correct - 8th words differ - expected: '?', found: '<' |
11 |
Incorrect |
306 ms |
6872 KB |
Output isn't correct - 4th words differ - expected: '?', found: '<' |
12 |
Incorrect |
417 ms |
10172 KB |
Output isn't correct - 4th words differ - expected: '?', found: '>' |
13 |
Correct |
449 ms |
11096 KB |
Output is correct - 100000 tokens |
14 |
Correct |
445 ms |
11096 KB |
Output is correct - 100000 tokens |
15 |
Incorrect |
539 ms |
11096 KB |
Output isn't correct - 26th words differ - expected: '?', found: '<' |
16 |
Incorrect |
477 ms |
11096 KB |
Output isn't correct - 9th words differ - expected: '?', found: '>' |
17 |
Incorrect |
432 ms |
11096 KB |
Output isn't correct - 3rd words differ - expected: '?', found: '<' |
18 |
Incorrect |
466 ms |
11096 KB |
Output isn't correct - 4th words differ - expected: '?', found: '<' |
19 |
Incorrect |
473 ms |
11096 KB |
Output isn't correct - 17th words differ - expected: '?', found: '>' |
20 |
Incorrect |
424 ms |
11096 KB |
Output isn't correct - 13th words differ - expected: '?', found: '>' |
21 |
Incorrect |
433 ms |
11096 KB |
Output isn't correct - 11th words differ - expected: '?', found: '<' |
22 |
Incorrect |
409 ms |
11096 KB |
Output isn't correct - 11th words differ - expected: '?', found: '<' |
23 |
Incorrect |
476 ms |
11096 KB |
Output isn't correct - 7th words differ - expected: '?', found: '<' |
24 |
Incorrect |
412 ms |
11096 KB |
Output isn't correct - 3rd words differ - expected: '?', found: '<' |
25 |
Incorrect |
477 ms |
11096 KB |
Output isn't correct - 9th words differ - expected: '?', found: '<' |