Submission #591198

#TimeUsernameProblemLanguageResultExecution timeMemory
591198starchanTimovi (COCI18_timovi)C++17
80 / 80
15 ms3680 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define in pair<int, int> #define f first #define s second #define pb push_back #define pob pop_back #define INF (int)1e17 #define MX (int)3e5+5 #define fast() ios_base::sync_with_stdio(false); cin.tie(NULL) vector<int> a(MX, 0); int n, m, k; void dewit(int i, int change) { if(m < k) { a[i]+=m; return; } m-=k; a[i]+=k; if(i+change < 1 || i+change > n) change*=(-1); dewit(i+change, change); return; } signed main() { fast(); cin >> n >> k >> m; int period = 2*(n-1)*k; int times = m/period; m%=period; a[1] = times*k; for(int i = 2; i < n; i++) a[i] = 2*times*k; a[n] = times*k; dewit(1, +1); for(int i = 1; i <= n; i++) cout << a[i] << " "; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...