Submission #591198

# Submission time Handle Problem Language Result Execution time Memory
591198 2022-07-07T04:18:09 Z starchan Timovi (COCI18_timovi) C++17
80 / 80
15 ms 3680 KB
#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 time Memory Grader output
1 Correct 2 ms 2708 KB Output is correct
2 Correct 1 ms 2644 KB Output is correct
3 Correct 13 ms 3044 KB Output is correct
4 Correct 13 ms 3008 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 15 ms 3668 KB Output is correct
8 Correct 15 ms 3680 KB Output is correct