Submission
Status:
(PP-SSSSSSSSSS)(PPPPPPPPP)(PPPPPPPPPP)(-SSSSSSSSS)(-SSSSSSSSSSSSS)(-SSSSSSSSSSSSSSSSSS)(-SSSSSSSSSSSSSSSSSSSSS)
Subtask/Task Score:
{0/4}{4/4}{5/5}{0/7}{0/25}{0/34}{0/21}
Score: 9
User: GGEZLOLx3D
Problemset: ร้านปลอดภาษี (Duty Free)
Language: cpp
Time: 0.104 second
Submitted On: 2026-03-26 18:15:24
#include<bits/stdc++.h>
#include "duty_free.h"
using namespace std;
// you can write more function here
int minimum_bag_rearrangement_time(std::vector<int> max_allowed_positions) {
int n=max_allowed_positions.size();
vector<bool> mp(n+1,false);
vector<int> res;
int c=0,i,j,mx=0,jum=0;
for(i=0;i<n;i++){
if(max_allowed_positions[i]>mx){
mx=max_allowed_positions[i];
jum+=1;
}
else{
if(jum>=mx){
c++;
mx=max_allowed_positions[i];
jum=1;
}
else{
jum++;
}
}
}
return c;
}