# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
652310 | Genius3435 | Kotrljanje (COCI18_kotrljanje) | C++17 | 422 ms | 16748 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int constexpr DS = 32768;
vector<ll> vals[DS];
int B;
int ds(ll n) {
int s = 0;
while (n) s += n%B, n /= B;
return s;
}
int main() {
int C, D, M;
cin >> C >> D >> B >> M;
int mx_cnt = 0, mxi = -1;
for (ll n = 1; mx_cnt < M; n += B-1) {
int s = ds(C*n+D);
vals[s].push_back(n);
if (vals[s].size() > mx_cnt) {
mx_cnt = vals[s].size();
mxi = s;
}
}
for (ll const n : vals[mxi]) {
cout << n << ' ';
}
cout << '\n';
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |