# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
17832 | Elibay | Weighting stones (IZhO11_stones) | C++14 | 1000 ms | 11096 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 (z <= 3e4 + 2e3 + 8e2 && n <= 7e4)
{
if ((Sx > My && kol2 >= kol1) || (Sy > Mx && kol1 >= kol2))
Solve1 ();
else
puts ("?");
}
else if (n <= 7e4)
puts ("?");
else
{
if ((Sx > My && kol2 >= kol1))
puts ("<");
else if ((Sy > Mx && kol1 >= kol2))
puts (">");
else
puts ("?");
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |