Submission #200157

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

const int maxn = 5000 + 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 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 Runtime error 5 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 Runtime error 15 ms 544 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 Runtime error 6 ms 480 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 Runtime error 14 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 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 82 ms 480 KB Output is correct
2 Correct 877 ms 1504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1899 ms 2568 KB Output is correct
2 Correct 1239 ms 2948 KB Output is correct
3 Execution timed out 2092 ms 2448 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 141 ms 2516 KB Output is correct
2 Correct 1144 ms 3448 KB Output is correct
3 Correct 89 ms 3704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -