Submission #739102

#TimeUsernameProblemLanguageResultExecution timeMemory
739102mzvTimovi (COCI18_timovi)C++17
0 / 80
14 ms1948 KiB
#include <bits/stdc++.h> #define ccd ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define ll long long #define endl '\n' using namespace std; /* ------------------------ hi lol ------------------------ */ ll n,k,m,arr[200001],def,le,ri,i; int main() { ccd cin >> n >> k >> m; if (m/(n*k)>0) { m-=n*k; def=1+(m/((n-1)*k)); le=(def/2)+1; ri=(def/2)+(def%2); m-=(def-1)*((n-1)*k); } // tentuin nilai def,le,ri, sama sisa orng (m), baru lanjut cout << def << " " << le << " " << ri << " " << m << endl; while (m>0) { if (def==0) { i=1; while (m-k>=0) { arr[i]=k; m-=k; i++; } } else if (def%2==0) { i=2; while (m-k>=0) { arr[i]=k; m-=k; i++; } } else { i=n-1; while (m-k>=0) { arr[i]=k; m-=k; i--; } } arr[i]=m; break; } cout << (arr[1]+(le*k)) << " "; for (int i=2;i<n;i++) { cout << (arr[i]+(def*k)) << " "; } cout << (arr[n]+(ri*k)) << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...