Submission #87063

# Submission time Handle Problem Language Result Execution time Memory
87063 2018-11-29T10:35:11 Z rakuten Weighting stones (IZhO11_stones) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
using namespace std;

set < int > v1 ;
set < int > :: iterator it1 ;
set < int > v2 ;
set < int > :: iterator it2 ;
int x1 , x2 ;
main()
{
    int a , b;
    int n;
    cin >> n;
    cin >> a >> b ;
    if(b == 2)
    {
        cout << "<" << endl;
        v1.insert (a) ;
    }
    else
    {
        cout << ">" << endl;
        v2.insert (a) ;
    }

    for(int i = 2; i <= n; i++)
    {
        x1 = 0 ;
        x2 = 0 ;
        cin >> a >> b;
        if (b == 1)
            v1.insert (a) ;
        else
            v2.insert (a) ;
        if (v1.size() == 0)
        {
            cout << '<' << endl ;
        }
        else
        if (v2.size() == 0)
        {
            cout << '>' << endl ;
        }
        else
        {
            it1 = -- v1.end() ;
            it2 = -- v2.end() ;
            for ( ; ; )
            {
                if ( *it1 > *it2 )
                    x1 ++ ;
                else
                    x2 ++ ;
                if (it1 == v1.begin () || it2 == v2 .begin ())
                    break ;
                it1 -- ;
                it2 -- ;
            }
            if ( x1 == 0 && x2 == v1.size() )
                cout << '<' << endl ;
            else
            if ( x2 == 0 && x1 == v2.size() )
                cout << '>' << endl ;
            else
                cout << '?' << endl ;

        }


    }

}

Compilation message

stones.cpp:9:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
stones.cpp: In function 'int main()':
stones.cpp:59:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if ( x1 == 0 && x2 == v1.size() )
                             ~~~^~~~~~~~~~~~
stones.cpp:62:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if ( x2 == 0 && x1 == v2.size() )
                             ~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -