Submission #666464

#TimeUsernameProblemLanguageResultExecution timeMemory
666464TrumlingRobots (IOI13_robots)C++14
0 / 100
140 ms4740 KiB
#include "robots.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define F first #define S second #define enter cout<<'\n'; int putaway(int a, int b, int t, int x[], int y[], int w[], int s[]) { sort(x,x+a,greater<ll>()); sort(w,w+t,greater<ll>()); if(x[0]<=w[0]) return -1; ll idx=0; ll arr[a+1]; for(int i=0;i<a;i++) { while(idx<t && w[idx]>=x[i]) { idx++; } arr[i]=idx; } arr[a]=t; ll pre=arr[0],rest=0,count=1; ll time=0; for(int i=1;i<=a;i++) { if(arr[i]==pre){ count++; continue; } ll now=(arr[i]-pre)/count; ll rem=(arr[i]-pre)%count; if(rem){ now++; rem=count-rem; } if(time==0) { count=1; time=now; rest+=rem; pre=arr[i]; continue; } if(now<=time) { if(now<time) rest+=count*(time-now); else rest+=rem; count=1; pre=arr[i]; continue; } ll toys=(arr[i]-pre)-count*time-rest; if(toys<=0) { count=1; rest=-toys; pre=arr[i]; continue; } now=toys/(i+1); if(toys%(i+1)) { now++; rest=i+1-toys%(i+1); } else rest=0; time=now; pre=arr[i]; count=1; } return time; }
#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...