Submission #844419

# Submission time Handle Problem Language Result Execution time Memory
844419 2023-09-05T13:04:00 Z vjudge1 Pod starim krovovima (COCI20_psk) C++17
36 / 50
1 ms 348 KB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define pri pair<int,int>
#define prl pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pair<int,int>>
#define vpl vector<pair<ll,ll>>
#define re return 0
#define sqrt sqrtl

int32_t main() {
    int n;cin>>n;
    int sum = 0;
    vector<int> st(n);
    for (int i = 0;i<n;i++) {
        int t;cin>>t>>st[i];
        sum+=t;
    }
    sort(st.begin(),st.end(),greater<int>());
    vector<int> c(n,0);
    int a = 0;
    for (int i = 0;i<n;i++) {
        c[i] = min(st[i],sum);
        sum-=c[i];
        if (c[i]==0) a++;
    }
    cout<<a<<endl;
    for (int i = 0;i<n;i++) {
        cout<<c[i]<<" ";
    }cout<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Partially correct 0 ms 344 KB Output is partially correct
6 Partially correct 0 ms 344 KB Output is partially correct
7 Partially correct 0 ms 348 KB Output is partially correct
8 Partially correct 1 ms 344 KB Output is partially correct
9 Incorrect 1 ms 344 KB Output isn't correct
10 Incorrect 1 ms 344 KB Output isn't correct