이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
░░░░██████████████████
░░▄███████▀▀▀▀▀▀███████▄
░▐████▀▒mohammad▒▀██████▄
░███▀▒▒▒▒alaa▒▒▒▒▒▒▀█████
░▐██▒▒▒alwrawrah▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
*/
#include<bits/stdc++.h>
#include "robots.h"
using namespace std;
typedef long long ll ;
const ll oo = 1e13 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7 ;
vector<int> v;
int ans =0 ;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
sort(X , X + A) ;
sort(W , W + T) ;
if(X[A - 1] < W[T - 1])return -1;
else{
int ls = 0;
int x = 1 , lx = 0 ;
for(int i = 0 ; i < A ; ++i){
if(X[i] < W[0])continue;
auto it = (lower_bound(W , W + T , X[i]) - W);
v.push_back(it - ls);
ls = it;
}
ans = v.back() ;
for(int i = v.size() - 2 ; i >= 0 ; --i){
if(v[i] > ans){
if(lx){
int xx = lx ;
v[i] -= ans ;
lx -= min(lx , v[i]);
v[i] -= min(v[i] , xx);
if(v[i]){
lx = (x + 1) - v[i] % (x + 1);
ans += (v[i] + x) / (x + 1);
}
}else if(ans < (v[i] - ans + x) / (x + 1) + ans){
lx = (x + 1) - (v[i] - ans) % (x + 1) ;
ans = (v[i] - ans + x) / (x + 1) + ans;
}
}else{
lx += ans - v[i];
}
x++;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |