94362024-02-21 17:30:26Vkrisztian01Ládapakolás raktárban (50)cpp11Wrong answer 0/5052ms4532 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
base0/50
1Wrong answer0/03ms1872 KiB
2Wrong answer0/04ms2124 KiB
3Wrong answer0/23ms2336 KiB
4Wrong answer0/23ms2548 KiB
5Wrong answer0/23ms2760 KiB
6Wrong answer0/23ms2916 KiB
7Wrong answer0/23ms3160 KiB
8Wrong answer0/23ms3368 KiB
9Wrong answer0/33ms3460 KiB
10Wrong answer0/23ms3420 KiB
11Wrong answer0/23ms3424 KiB
12Wrong answer0/23ms3424 KiB
13Wrong answer0/34ms3552 KiB
14Wrong answer0/34ms3764 KiB
15Wrong answer0/36ms3976 KiB
16Wrong answer0/230ms4096 KiB
17Wrong answer0/341ms4084 KiB
18Wrong answer0/352ms4304 KiB
19Wrong answer0/330ms4284 KiB
20Wrong answer0/332ms4532 KiB
21Wrong answer0/330ms4520 KiB
22Wrong answer0/335ms4520 KiB