Submission #201838

#TimeUsernameProblemLanguageResultExecution timeMemory
201838mohammadRobots (IOI13_robots)C++14
14 / 100
272 ms15752 KiB
/* ░░░░██████████████████ ░░▄███████▀▀▀▀▀▀███████▄ ░▐████▀▒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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...