Submission #17774

# Submission time Handle Problem Language Result Execution time Memory
17774 2016-01-12T10:58:51 Z Elibay Weighting stones (IZhO11_stones) C++14
36 / 100
1000 ms 11092 KB
#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;

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)
        {
            auto w = S.begin ();
            S.erase (w);
            S.insert (x);
        }
        else if (y == 1)
        {
            auto w = s.begin ();
            s.erase (s.begin ());
            s.insert (x);
        }
        int k1 = 0, k2 = 0;
        auto i = s.begin (); 
        auto j = S.begin ();
        for (int q = 1; q <= n; ++ q)
        {
            int X = *i;
            int Y = *j;
            if (Y > X)
                k1++;
            if (X > Y)
                k2++;
            ++ i;
            ++ j;
        }
        if (k2 == 0)
            puts ("<");
        else if (k1 == 0)
            puts (">");
        else    
            puts ("?");
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1720 KB Output is correct - 73 tokens
2 Correct 0 ms 1720 KB Output is correct - 89 tokens
3 Correct 0 ms 1720 KB Output is correct - 221 tokens
4 Correct 0 ms 1720 KB Output is correct - 21 tokens
5 Correct 5 ms 1720 KB Output is correct - 369 tokens
6 Correct 0 ms 1720 KB Output is correct - 492 tokens
7 Correct 0 ms 1720 KB Output is correct - 945 tokens
8 Correct 26 ms 1720 KB Output is correct - 1237 tokens
9 Correct 55 ms 1720 KB Output is correct - 1105 tokens
10 Execution timed out 1000 ms 2512 KB Program timed out
11 Execution timed out 1000 ms 6868 KB Program timed out
12 Execution timed out 1000 ms 10168 KB Program timed out
13 Execution timed out 1000 ms 11092 KB Program timed out
14 Execution timed out 1000 ms 11092 KB Program timed out
15 Execution timed out 1000 ms 11092 KB Program timed out
16 Execution timed out 1000 ms 11092 KB Program timed out
17 Execution timed out 1000 ms 11092 KB Program timed out
18 Execution timed out 1000 ms 11092 KB Program timed out
19 Execution timed out 1000 ms 11092 KB Program timed out
20 Execution timed out 1000 ms 11092 KB Program timed out
21 Execution timed out 1000 ms 11092 KB Program timed out
22 Execution timed out 1000 ms 11092 KB Program timed out
23 Execution timed out 1000 ms 11092 KB Program timed out
24 Execution timed out 1000 ms 11092 KB Program timed out
25 Execution timed out 1000 ms 11092 KB Program timed out