Submission #491189

#TimeUsernameProblemLanguageResultExecution timeMemory
491189mosiashvililukaDistributing Candies (IOI21_candies)C++17
3 / 100
5054 ms20292 KiB
#include<bits/stdc++.h> #include "candies.h" using namespace std; long long a,b,c,d,e,i,j,ii,jj,zx,xc,tes,t,C[200009],L[200009],R[200009],V[200009],f[200009]; vector <int> ans; vector<int> distribute_candies(vector<int> Cc, vector<int> Ll, vector<int> Rr, vector<int> Vv) { a=Cc.size();tes=Ll.size(); for(i=1; i<=a; i++){ C[i]=Cc[i-1]; } for(t=1; t<=tes; t++){ L[t]=Ll[t-1]+1;R[t]=Rr[t-1]+1;V[t]=Vv[t-1]; } for(t=1; t<=tes; t++){ for(i=L[t]; i<=R[t]; i++){ f[i]+=V[t]; f[i]=max(0LL,f[i]);f[i]=min(C[i],f[i]); } } for(i=1; i<=a; i++) ans.push_back(f[i]); 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...