답안 #963880

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
963880 2024-04-16T01:17:44 Z irmuun 로봇 (IOI13_robots) C++17
0 / 100
3000 ms 4444 KB
#include<bits/stdc++.h>
#include "robots.h"

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

int putaway(int A,int B,int T,int X[],int Y[],int W[],int S[]){
    pair<int,int>toy[T];
    for(int i=0;i<T;i++){
        toy[i].ff=W[i];
        toy[i].ss=S[i];
    }
    sort(toy,toy+T);
    sort(X,X+A);
    sort(Y,Y+B);
    int l=1,r=T+1;
    vector<bool>used(T);
    while(l<r){
        int mid=(l+r)/2;
        fill(all(used),0);
        set<pair<int,int>,greater<pair<int,int>>>st;
        int le=0,cur;
        for(int i=0;i<A;i++){
            while(le<T&&toy[le].ff<X[i]){
                st.insert({toy[le].ss,le});
            }
            cur=mid;
            while(cur--&&!st.empty()){
                used[st.begin()->ss]=true;
                st.erase(st.begin());
            }
        }
        st.clear();
        for(int i=0;i<T;i++){
            if(!used[i]){
                st.insert({toy[i].ss,i});
            }
        }
        for(int i=B-1;i>=0;i--){
            int cur=mid;
            while(cur--&&!st.empty()){
                if(st.begin()->ff<Y[i]){
                    st.erase(st.begin());
                }
                else break;
            }
        }
        if(st.empty()) l=mid+1;
        else r=mid;
    }
    if(l==T+1) return -1;
    return l;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3052 ms 4444 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3012 ms 4440 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3043 ms 4440 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3014 ms 4440 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3007 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -