Submission #1466358


Source Code Expand

Copy
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <cstring>
#include <map>
#include <bitset>
#include <random>
#include <stack>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <ctime>

using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define sc second
#define fs first
#define mp make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

template<class T> T sqr(T x) { return x*x; }
ld pi = 3.1415926535897932384626433832795;
ll mod = 1e9 + 7;
const int N = 1e6 + 10;

typedef vector<vector<ll> > mtrx;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

ll ans[111];

void try_solve(ll k, int n) {
	while (k--) {
		int id = 0;
		for (int i = 0; i < n; i++)
			if (ans[i] > ans[id]) id = i;
		for (int i = 0; i < n; i++) ans[i] += 1;
		ans[id] -= n + 1;
	}
	cout << "\nSEEE\n";
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		cout << ans[i] << ' ';
		sum += ans[i];
	}
	cout << "SUM" << ' ' << sum;
}

int main(){
	ll k;
	cin >> k;
	if (k == 1) {
		cout << 3 << '\n' << 0 << ' ' << 0 << ' ' << 3;
	}
	else if (k == 2) {
		cout << 2 << '\n' << 2 << ' ' << 2;
	} else if (k < 1000)
	cout << 2 << '\n' << 2 - 1 << ' ' << 2ll - 1ll + k;
	else {
		ll n = 50;
		ll cur = k;
		for (int i = 0; i < n; i++) {
			ans[i] = 0;
			ll add = min(cur, k / n);
			ans[i] += add;
			cur -= add;
		}
		for (int i = 0; i < cur; i++)
			ans[i] += 1+n-cur;
		//ans[0] += 10;
		cout << n << endl;
		for (int i = 0; i < n; i++) {
			cout << ans[i] << ' ';
		}
		//try_solve(k, n);
	}
	return 0;
}

Submission Info

Submission Time
Task D - Decrease (Contestant ver.)
User theconfessor
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1733 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
AC × 4
WA × 1
AC × 6
WA × 19
Set Name Test Cases
Sample example0, example1, example2, example3, example4
All corner0, corner1, corner2, corner3, corner4, corner5, corner6, corner7, corner8, corner9, example0, example1, example2, example3, example4, rand0, rand1, rand2, rand3, rand4, rand5, rand6, rand7, rand8, rand9
Case Name Status Exec Time Memory
corner0 WA 1 ms 256 KB
corner1 WA 1 ms 256 KB
corner2 AC 1 ms 256 KB
corner3 WA 1 ms 256 KB
corner4 WA 1 ms 256 KB
corner5 WA 1 ms 256 KB
corner6 WA 1 ms 256 KB
corner7 WA 1 ms 256 KB
corner8 AC 1 ms 256 KB
corner9 WA 1 ms 256 KB
example0 AC 1 ms 256 KB
example1 AC 1 ms 256 KB
example2 AC 1 ms 256 KB
example3 AC 1 ms 256 KB
example4 WA 1 ms 256 KB
rand0 WA 1 ms 256 KB
rand1 WA 1 ms 256 KB
rand2 WA 1 ms 256 KB
rand3 WA 1 ms 256 KB
rand4 WA 1 ms 256 KB
rand5 WA 1 ms 256 KB
rand6 WA 1 ms 256 KB
rand7 WA 1 ms 256 KB
rand8 WA 1 ms 256 KB
rand9 WA 1 ms 256 KB