Submission #200159

# Submission time Handle Problem Language Result Execution time Memory
200159 2020-02-05T14:35:43 Z Saboon Kotrljanje (COCI18_kotrljanje) C++14
70 / 140
2000 ms 4092 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const int maxn = 200000 + 37;

int a[maxn];

int cntdig(ll x, ll b){
	int ret = 0;
	while (x){
		ret += (x % b);
		x /= b;
	}
	return ret;
}

int main(){
	ios_base::sync_with_stdio(false);
	ll c, d, b, m;
	cin >> c >> d >> b >> m;
	ll t = 1;
	while (t <= d)
		t *= b;
	t *= (b - 1);
	int can;
	for (int i = 1; ; i++){
		ll x = c * t * i + d;
		a[cntdig(x, b)] ++;
		if (a[cntdig(x, b)] == m){
			can = cntdig(x, b);
			break;
		}
	}
	for (int i = 1; m; i++){
		ll x = c * t * i + d;
		if (cntdig(x, b) == can){
			cout << t * i << " ";
			m --;
		}
	}
	cout << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 376 KB Unsigned integer 1000449200233980 violates the range [1, 1000000000000000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 80 ms 3192 KB Output is correct
2 Correct 82 ms 3192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 83 ms 3320 KB Output is correct
2 Correct 86 ms 3320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 89 ms 3468 KB Output is correct
2 Runtime error 8 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Correct 88 ms 3576 KB Output is correct
2 Correct 233 ms 3328 KB Output is correct
3 Correct 108 ms 4092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 79 ms 376 KB Output is correct
2 Correct 882 ms 1412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1871 ms 2680 KB Output is correct
2 Correct 1237 ms 3192 KB Output is correct
3 Execution timed out 2083 ms 2680 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 140 ms 2552 KB Output is correct
2 Correct 1124 ms 3448 KB Output is correct
3 Correct 88 ms 3580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -