Submission
Status:
(PPPPPPPPPPPPP)(PPPPPPPPP)(PPPPPPPPPP)(PPPPPPPPPP)(PPPPPPPPPPPPPP)(TSSSSSSSSSSSSSSSSSS)(TSSSSSSSSSSSSSSSSSSSSS)
Subtask/Task Score:
{4/4}{4/4}{5/5}{7/7}{25/25}{0/34}{0/21}
Score: 45
User: kungarooo
Problemset: ร้านปลอดภาษี (Duty Free)
Language: cpp
Time: 1.092 second
Submitted On: 2025-11-01 22:18:19
#include <bits/stdc++.h>
using namespace std;
// you can write more function here
int minimum_bag_rearrangement_time(vector<int> max_allowed_positions) {
int sz=max_allowed_positions.size(),ans=0;
//set<int> eridx;
multiset<int> s;
for(int i=0;i<sz;i++){
bool can=1;
s.insert(max_allowed_positions[i]);
int idx=1;
for(auto i:s){
if(i>=idx){
idx++;
}else{
can=0;
break;
}
}
if(!can){
s.clear();
s.insert(max_allowed_positions[i]);
ans++;
}
}
return ans;
}