Submission #928095

# Submission time Handle Problem Language Result Execution time Memory
928095 2024-02-15T20:40:21 Z xad Hokej (COCI17_hokej) C++14
0 / 120
106 ms 12980 KB
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
#define nn "\n"
#define x_x ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define intt int _; cin >> _; while (_--)
#define emp push_back
#define mod 1000000007
#define all(v) v.begin(), v.end()
#define ld long double
#define A first
#define B second
typedef long long ll;
const ld eps = 1e-27;
// diff between decimals 0.000000001 mt19937 mt(time(nullptr));
int fx[]={1,-1,0,0}, fy[]={0,0,1,-1};

int main() {
    /*freopen("measurement.in","r",stdin);
    freopen("measurement.out","w", stdout);*/

    x_x
   int m,n; cin>>m>>n; pair<ll,int>ar[n]; int mtch[7]={}; mtch[6]=m;
   for(auto&i:ar) cin>>i.A>>i.B;
   sort(ar, ar+n, greater<pair<ll,int>>());
   ll ans=0;
   for (int i=0; i<n; i++) {
        int nw[7]={};
    for (int j=6; j>=1&&ar[i].B; --j) {
        if (!mtch[j]) { continue;}
       ll x=min(mtch[j],ar[i].B); ar[i].B-=x, mtch[j]-=x; nw[j-1]+=x;
       ans+=(x*ar[i].A);
    }
    for (int j=1; j<7; j++)mtch[j]+=nw[j];
   }
   cout<<ans;
   return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
2 Incorrect 1 ms 600 KB Unexpected end of file - int32 expected
3 Incorrect 5 ms 1080 KB Unexpected end of file - int32 expected
4 Incorrect 0 ms 344 KB Unexpected end of file - int32 expected
5 Incorrect 2 ms 604 KB Unexpected end of file - int32 expected
6 Incorrect 1 ms 348 KB Unexpected end of file - int32 expected
7 Incorrect 2 ms 660 KB Unexpected end of file - int32 expected
8 Incorrect 21 ms 2652 KB Unexpected end of file - int32 expected
9 Incorrect 106 ms 12880 KB Unexpected end of file - int32 expected
10 Incorrect 101 ms 12980 KB Unexpected end of file - int32 expected