94352024-02-21 17:29:52Vkrisztian01Ládapakolás raktárban (50)cpp11Wrong answer 30/5052ms4488 KiB
#include <iostream>
#include<vector>
#include<set>

using namespace std;


int n,m,akt,elozo=0,osszeg=0,db=0;
bool emelkedik=true;
set<int>seged;

int main()
{
   cin>>n>>m;
   for(int i=1;i<=n;i++)
   {
       cin>>akt;
       if(osszeg+akt>m || seged.count(akt) || (!emelkedik && elozo<akt))
       {
           ++db;
           osszeg=0;
           seged.clear();
           emelkedik=true;
       }
       else
       {
           if(akt<elozo) emelkedik=false;
       }
       osszeg+=akt;
       elozo=akt;
   }
   ++db;
   cout<<n-db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/50
1Accepted0/03ms1772 KiB
2Wrong answer0/04ms1992 KiB
3Accepted2/23ms2204 KiB
4Wrong answer0/23ms2456 KiB
5Accepted2/23ms2632 KiB
6Accepted2/23ms2840 KiB
7Accepted2/22ms2920 KiB
8Accepted2/23ms3052 KiB
9Accepted3/33ms3260 KiB
10Accepted2/23ms3340 KiB
11Wrong answer0/23ms3444 KiB
12Wrong answer0/23ms3652 KiB
13Accepted3/34ms3904 KiB
14Wrong answer0/34ms4076 KiB
15Accepted3/36ms4164 KiB
16Wrong answer0/230ms4160 KiB
17Accepted3/339ms4156 KiB
18Accepted3/352ms4288 KiB
19Accepted3/330ms4372 KiB
20Wrong answer0/332ms4400 KiB
21Wrong answer0/330ms4372 KiB
22Wrong answer0/335ms4488 KiB