Submission #87023

# Submission time Handle Problem Language Result Execution time Memory
87023 2018-11-29T08:35:37 Z rakuten Weighting stones (IZhO11_stones) C++17
0 / 100
3 ms 376 KB
#include <bits/stdc++.h>

#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define ll long long
#define OK puts("OK")
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 1e5+10;
const int inf = 1e9+7;

int x , a , n , x1 , x2;
set < int > v ;
set < int > :: iterator  vi ;
set < int > q ;
set < int > :: iterator  qi ;
int main()
 {
     cin >> n ;
     for (int i = 0 ;i < n ;i ++ )
     {
         x1 = 0 ;
         x2 = 0 ;
         cin >> x >> a ;
         if (i == 0)
         {
             if (a == 1)
                cout << '>' << endl ;
             else
                cout << '<' << endl ;
                 if (a == 1)
            v.insert (x) ;
         else
            q.insert (x) ;
         }
         else
         {

         if (a == 1)
            v.insert (x) ;
         else
            q.insert (x) ;
            if (v.size() == 0)
            {
                cout << '<' << endl ;
            }
            else
            if (q.size() == 0 )
            {
                cout << '>' << endl ;
            }
            else
            {

              qi = --q.end();
            for (vi = --v.end();  ; vi -- )
            {
             if ( (*vi) > (*qi))
                x1 ++ ;
             else
                x2 ++ ;
            if (qi == q.begin() || vi == v.begin())
                break;
            qi -- ;
            }
         if (x1 > x2 && x2 == 0 )
         {

                cout << '>' << endl ;
         }
         else
            if (x1 < x2 && x1 == 0)
            cout << '<' << endl;
         else
            cout << '?' << endl ;
            }
         }
     }


}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:46:10: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
          else
          ^~~~
stones.cpp:48:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
             if (v.size() == 0)
             ^~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -