Submission #711439

#TimeUsernameProblemLanguageResultExecution timeMemory
711439ToroTNMeasures (CEOI22_measures)C++14
0 / 100
175 ms13868 KiB
#include<bits/stdc++.h> using namespace std; int n,m,d,a,ans=0,l,r; double chng; multiset<int> ms; int main() { ios_base::sync_with_stdio(0),cin.tie(0); cin >> n >> m >> d; for(int i=1;i<=n+m;i++) { cin >> a; if(ms.size()==0) { ms.insert(a); chng=ans/2; if(i>n) { if(floor(chng)==chng) { printf("%.0f ",chng); }else { printf("%.1f ",chng); } } continue; } auto it=ms.lower_bound(a); if(it==ms.end()) { --it; ans+=(d-(a-(*it))); }else if(it==ms.begin()) { ans+=(d-((*it)-a)); }else { r=(*it); --it; l=(*it); ans-=(d-(r-l)); ans+=(d-(a-l)); ans+=(d-(r-a)); } ms.insert(a); chng=(double)ans/2; if(i>n) { if(floor(chng)==chng) { printf("%.0f ",chng); }else { printf("%.1f ",chng); } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...