# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
94613 | ahmedie404 | Timovi (COCI18_timovi) | C++14 | 919 ms | 2296 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
int ts[200000+9];
int n;
int k, m;
int main(){
scanf("%d %d %d", &n, &k, &m);
int idx=0;
bool forw=true;
for(int i=0;i<n;i++){
ts[i]=(m>=k)?k:m;
m-=(m>=k)?k:m;
if(m == 0)
break;
}
int ti = 2, st, en;
while(true){
if(m > 0){
if(ti%2 == 0)
for(int i=n-2;i>=0;i--){
ts[i]+=(m>=k)?k:m;
m-=(m>=k)?k:m;
if(m == 0)
break;
}
else
for(int i=1;i<n;i++){
ts[i]+=(m>=k)?k:m;
m-=(m>=k)?k:m;
if(m == 0)
break;
}
ti++;
} else
break;
}
for(int i=0;i<n;i++)
printf("%d ", ts[i]);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |