#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;
int MxMin, MyMin, MxMax, MyMax;
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 (MxMin == 0)
MxMin = INF;
if (MyMin == 0)
MyMin = INF;
if (y == 2)
{
Mx += x * 1.0 + 0.999, Sx += x * 1.0, kol2 ++;
auto w = S.begin ();
S.erase (w);
S.insert (x);
MxMin = min (x, MxMin);
MxMax = max (x, MxMax);
}
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);
MyMin = min (x, MyMin);
MyMax = max (x, MyMax);
}
if (MxMin == INF)
MxMin = 0;
if (MyMin == INF)
MyMin = 0;
if ((Sx > My && kol2 >= kol1 && MxMin > MyMin && MxMax > MyMax) || (Sy > Mx && kol1 >= kol2 && MyMax > MxMax && MyMin > MxMin))
Solve1 ();
else
puts ("?");
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1724 KB |
Output is correct - 73 tokens |
2 |
Incorrect |
0 ms |
1724 KB |
Output isn't correct - 5th words differ - expected: '>', found: '?' |
3 |
Correct |
0 ms |
1724 KB |
Output is correct - 221 tokens |
4 |
Incorrect |
1 ms |
1724 KB |
Output isn't correct - 5th words differ - expected: '<', found: '?' |
5 |
Incorrect |
6 ms |
1724 KB |
Output isn't correct - 4th words differ - expected: '<', found: '?' |
6 |
Incorrect |
0 ms |
1724 KB |
Output isn't correct - 27th words differ - expected: '<', found: '?' |
7 |
Incorrect |
0 ms |
1724 KB |
Output isn't correct - 3rd words differ - expected: '<', found: '?' |
8 |
Incorrect |
2 ms |
1724 KB |
Output isn't correct - 4th words differ - expected: '<', found: '?' |
9 |
Incorrect |
8 ms |
1724 KB |
Output isn't correct - 5th words differ - expected: '>', found: '?' |
10 |
Incorrect |
101 ms |
2516 KB |
Output isn't correct - 5th words differ - expected: '<', found: '?' |
11 |
Execution timed out |
1000 ms |
6872 KB |
Program timed out |
12 |
Execution timed out |
1000 ms |
10172 KB |
Program timed out |
13 |
Execution timed out |
1000 ms |
11096 KB |
Program timed out |
14 |
Execution timed out |
1000 ms |
11096 KB |
Program timed out |
15 |
Execution timed out |
1000 ms |
11096 KB |
Program timed out |
16 |
Execution timed out |
1000 ms |
11096 KB |
Program timed out |
17 |
Execution timed out |
1000 ms |
11096 KB |
Program timed out |
18 |
Execution timed out |
1000 ms |
0 KB |
Program timed out |
19 |
Execution timed out |
1000 ms |
11096 KB |
Program timed out |
20 |
Execution timed out |
1000 ms |
11096 KB |
Program timed out |
21 |
Execution timed out |
1000 ms |
11096 KB |
Program timed out |
22 |
Execution timed out |
1000 ms |
11096 KB |
Program timed out |
23 |
Execution timed out |
1000 ms |
11096 KB |
Program timed out |
24 |
Execution timed out |
1000 ms |
11096 KB |
Program timed out |
25 |
Execution timed out |
1000 ms |
11096 KB |
Program timed out |