Submission #200158

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

const int maxn = 100000 + 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 504 KB Unsigned integer 1000449200233980 violates the range [1, 1000000000000000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 78 ms 3192 KB Output is correct
2 Correct 81 ms 3192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 3320 KB Output is correct
2 Correct 85 ms 3320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 3448 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 90 ms 3576 KB Output is correct
2 Correct 226 ms 3320 KB Output is correct
3 Correct 110 ms 4088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 6 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 604 KB Output is correct
2 Correct 872 ms 1528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1891 ms 2808 KB Output is correct
2 Correct 1233 ms 3064 KB Output is correct
3 Execution timed out 2085 ms 2808 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 136 ms 2552 KB Output is correct
2 Correct 1131 ms 3576 KB Output is correct
3 Correct 87 ms 3576 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 -