답안 #87016

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
87016 2018-11-29T08:18:45 Z rakuten 돌 무게 재기 (IZhO11_stones) C++17
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>

#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define int 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 ;
 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) ;
         qi = --q.end();
         for (vi = --v.end();  ; vi -- )
         {
           //  cout << *vi << ' ' << * qi << endl ;
             if ( (*vi) > (*qi))
                x1 ++ ;
             else
                x2 ++ ;
            if (qi == q.begin() || vi == v.begin())
                break;
            qi -- ;
         }
      //   cout << endl ;
         if (x1 != x2)
         {
             if (x1 > x2)
                cout << '>' << endl ;
             else
                cout << '<' << endl ;
         }
         else
            cout << '?' << endl;
         }
     }


}

Compilation message

stones.cpp:22:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  main(){
       ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -