Submission #90759

# Submission time Handle Problem Language Result Execution time Memory
90759 2018-12-24T10:29:35 Z Aydarov03 Schools (IZhO13_school) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define fr first
#define sc second
using namespace std;

vector < pii > v;
vector < pii > v1 , v2;

main()
{
    multiset < int > rz;
    multiset < pii> v1 , v2;

    int x , y;
    int n , m , s , ans = 0;
    cin >> n >> m >> s;



    for(int i = 1; i <= n; i++)
    {
        scanf("%lld%ll
              d" , &x , &y);
        v.push_back( {x , y} );
    }

    sort( v.rbegin() , v.rend() );
    for(int i = 0; i < m; i++)
    {
        ans += v[i].fr;
        rz.insert( -(v[i].fr - v[i].sc) );
    }

    for(int i = m; i < n; i++)
    {
        v1.insert( v[i] );
        v2.insert( {v[i].sc , v[i].fr} );
    }



    for(int i = s; i >= 1; i--)
    {
        pii x = *v1.rbegin();
        pii y = *v2.rbegin();
        int raz = *rz.begin();

        if( x.fr + raz > y.fr )
        {
            ans += (x.fr + raz);
            rz.erase( rz.begin() );
            rz.insert( -( x.fr - x.sc ) );
            v1.erase( v1.find( {x.fr , x.sc}) );
            v2.erase( v2.find( {x.sc , x.fr} ) );
        }
        else
        {

            ans += y.fr;
            v2.erase( v2.find( {y.fr , y.sc } ) );
            v1.erase( v1.find( { y.sc , y.fr } ) );
        }
    }
    cout << ans << endl;


}

Compilation message

school.cpp:24:15: warning: missing terminating " character
         scanf("%lld%ll
               ^
school.cpp:24:15: error: missing terminating " character
         scanf("%lld%ll
               ^~~~~~~~
school.cpp:25:16: warning: missing terminating " character
               d" , &x , &y);
                ^
school.cpp:25:16: error: missing terminating " character
               d" , &x , &y);
                ^~~~~~~~~~~~~
school.cpp:11:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
school.cpp: In function 'int main()':
school.cpp:25:15: error: 'd' was not declared in this scope
               d" , &x , &y);
               ^
school.cpp:16:9: warning: unused variable 'x' [-Wunused-variable]
     int x , y;
         ^
school.cpp:16:13: warning: unused variable 'y' [-Wunused-variable]
     int x , y;
             ^