ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1991. The battle near the swamp

help me, find mistake, 5 test
Posted by buyolitsez 13 Nov 2018 21:04
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    int n,k;
    cin >> n >> k;
    int dontused=0,dontdie=0;
    int f;
    for(int i=0;i<n;i++)
    {
        cin >> f;
        if(k>f)
        {
            dontdie+=k-f;
        }
        if(k<f)
        {
            dontused+=f-k;
        }
    }
    cout << dontused << " " << dontdie;
    return 0;
}