Submission #17773

# Submission time Handle Problem Language Result Execution time Memory
17773 2016-01-12T10:58:28 Z Elibay Weighting stones (IZhO11_stones) C++
Compilation error
0 ms 0 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;
}

Compilation message

stones.cpp: In function ‘int main()’:
stones.cpp:25:13: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
             auto w = S.begin ();
             ^
stones.cpp:25:18: error: ‘w’ does not name a type
             auto w = S.begin ();
                  ^
stones.cpp:26:22: error: ‘w’ was not declared in this scope
             S.erase (w);
                      ^
stones.cpp:31:13: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
             auto w = s.begin ();
             ^
stones.cpp:31:18: error: ‘w’ does not name a type
             auto w = s.begin ();
                  ^
stones.cpp:36:9: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
         auto i = s.begin (); 
         ^
stones.cpp:36:14: error: ‘i’ does not name a type
         auto i = s.begin (); 
              ^
stones.cpp:37:9: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
         auto j = S.begin ();
         ^
stones.cpp:37:14: error: ‘j’ does not name a type
         auto j = S.begin ();
              ^
stones.cpp:40:22: error: name lookup of ‘i’ changed for ISO ‘for’ scoping [-fpermissive]
             int X = *i;
                      ^
stones.cpp:40:22: note: (if you use ‘-fpermissive’ G++ will accept your code)
stones.cpp:40:22: error: invalid type argument of unary ‘*’ (have ‘int’)
stones.cpp:41:22: error: ‘j’ was not declared in this scope
             int Y = *j;
                      ^