답안 #87068

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

using namespace std;

int x , a , n , x1 , x2;
set < int > v ;
set < int > :: iterator  vi ;
set < int > q ;
set < int > :: iterator  qi ;
int main()
{
     scanf ("%d" , &n) ;
     for (int i = 0 ;i < n ;i ++ )
     {
         x1 = 0 ;
         x2 = 0 ;
         scanf ("%d%d" , &x , &a) ;
         if ( a == 1)
         {
             v.insert (x) ;
         }
         else
         {
             q.insert (x) ;
         }
     }

                qi = -- q.end();
                for (vi = --v.end(); ; vi -- )
                {
                    if ( (*vi) > (*qi))
                    {
                        x1 ++ ;

                    }
                    else
                        x2 ++ ;
                    if (qi == q.begin()|| vi == v.begin() )
                        break;
                    qi -- ;
                }
            cout << x1 << ' ' << x2 << endl ;
}

Compilation message

stones.cpp: In function 'int main()':
stones.cpp:12:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
      scanf ("%d" , &n) ;
      ~~~~~~^~~~~~~~~~~
stones.cpp:17:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
          scanf ("%d%d" , &x , &a) ;
          ~~~~~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -