216702026-01-13 17:57:08algoproBájital (80 pont)cpp17Wrong answer 18/8041ms1396 KiB
// UUID: a4024ec5-56cb-4405-a482-443886cc5791
#include <bits/stdc++.h>
using namespace std;


int main() {
   long long N=0;
   cin >> N;
   long long X=0;
   cin >> X;


   //long long FINAL=0;
   long long PotionBase=0;
   long long PotionExtra=0;


   vector<long long>A(N);
   for (long long i=0; i<N; i++) {
       cin >> A[i];
       //Reading in the input
       PotionBase+=A[i]%X;
       //Remaining part, which can not be grouped to size X packeges of the same ingredient
       PotionExtra+=A[i]/X; //it really should be ...+=(A[i]-(A[i]%X))/X;
       //These are size Xpackeges of the same ingredient (Possibly will be disassembled to PotionBases)
   }

   /*for (long long i=0; i!=1;) {
       if (PotionBase<PotionExtra) {
           FINAL+=PotionBase;
           PotionExtra-=PotionBase;
           PotionBase=0;

           //Disassemlbing size X PotionExtras to X number of PotionBases
           PotionBase+=X;
           PotionExtra-=1;
       } else {
           FINAL+=PotionExtra;
           //Cycle suicide switch (it ends itself... so sad)
           i=1;
       }
   }*/

    if (PotionExtra <= PotionBase) {
        cout << PotionExtra;
    }
    else {
        cout << PotionBase + (PotionExtra*X)/(X+1);
    }

   //cout << FINAL;
}


SubtaskSumTestVerdictTimeMemory
base18/80
1Accepted0/01ms508 KiB
2Wrong answer0/01ms508 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms516 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/42ms412 KiB
8Wrong answer0/42ms316 KiB
9Accepted2/239ms1076 KiB
10Wrong answer0/239ms1268 KiB
11Wrong answer0/237ms1076 KiB
12Wrong answer0/239ms1076 KiB
13Wrong answer0/239ms1076 KiB
14Wrong answer0/239ms1080 KiB
15Wrong answer0/239ms1076 KiB
16Wrong answer0/239ms1396 KiB
17Wrong answer0/237ms1076 KiB
18Wrong answer0/239ms1076 KiB
19Wrong answer0/241ms1196 KiB
20Wrong answer0/239ms1332 KiB
21Wrong answer0/239ms1076 KiB
22Wrong answer0/237ms1268 KiB
23Wrong answer0/41ms316 KiB
24Accepted4/41ms316 KiB
25Wrong answer0/41ms316 KiB
26Accepted4/423ms1076 KiB
27Wrong answer0/437ms1188 KiB
28Wrong answer0/437ms1196 KiB
29Wrong answer0/437ms1076 KiB
30Accepted2/237ms1076 KiB
31Accepted2/237ms1076 KiB
32Accepted2/237ms1076 KiB
33Accepted2/237ms1080 KiB