# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
87068 | rakuten | Weighting stones (IZhO11_stones) | C++14 | 2 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |