# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1243864 | Dedibeat | Unscrambling a Messy Bug (IOI16_messy) | C++20 | 0 ms | 0 KiB |
#include "robots.h"
#include<bits/stdc++.h>
using namespace std;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[])
{
multiset<int, greater<int>> st;
for(int i = 0; i < T; i++)
st.insert(W[i]);
sort(X, X + A, greater<>());
int ans = 0;
while(!st.empty())
{
int flg = 0;
for(int i = 0; i < A; i++)
{
auto it = st.lower_bound(X[i]);
if(it != st.end()) st.erase(it), flg = 1;
}
if(!flg && !st.empty()) return -1;
ans++;
}
return ans;
}