Submission #142492

# Submission time Handle Problem Language Result Execution time Memory
142492 2019-08-09T10:02:59 Z KCSC Kotrljanje (COCI18_kotrljanje) C++14
28 / 140
2000 ms 2424 KB
#include <bits/stdc++.h>
using namespace std;

const int DIM = 50005;

int frq[DIM];

int convert(long long x, int b) {
    int s = 0;
    for (; x; x /= b)
        s += x % b;
    return s;
}

int main(void) {
   // freopen("kotrljanje.in", "r", stdin);
   // freopen("kotrljanje.out", "w", stdout);
    int c, d, b, m;
    cin >> c >> d >> b >> m;
    for (int i = 1; i; ++i) {
        int v = convert(1LL * c * i + d, b);
        ++frq[v];
        if (frq[v] == m) {
            for (int j = 1; j <= i; ++j)
                if (convert(1LL * c * j + d, b) == v)
                    cout << j << " ";
            break;
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 878 ms 632 KB Output is correct
2 Execution timed out 2012 ms 636 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2091 ms 404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2093 ms 504 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2013 ms 476 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2019 ms 504 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2017 ms 504 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 71 ms 528 KB Output is correct
2 Correct 803 ms 996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1792 ms 1964 KB Output is correct
2 Correct 1222 ms 2404 KB Output is correct
3 Execution timed out 2043 ms 2168 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 1042 ms 2424 KB Output is correct
2 Correct 928 ms 2168 KB Output is correct
3 Correct 1169 ms 2292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2025 ms 504 KB Time limit exceeded
2 Halted 0 ms 0 KB -