Submission #141217

# Submission time Handle Problem Language Result Execution time Memory
141217 2019-08-07T06:59:34 Z mariusnicoli Kotrljanje (COCI18_kotrljanje) C++14
28 / 140
2000 ms 3192 KB
#include <iostream>
#include <vector>
#include <map>

using namespace std;
int mp[30000];
long long c, d, b, m, p, i, n, suma, sol;

int main () {

    cin>>c>>d>>b>>m;
    p = 1;
    while (p <= d)
        p*=b;
    for (i=1;;i++) {
        n = 1LL*c*i*p+d;
        suma = 0;
        while (n) {
            suma += n%b;
            n/=b;
        }

        mp[suma] ++;

        if (mp[suma] == m) {
            sol = suma;
            break;
        }
        ///}
    }

    for (i=1;m;i++) {
        n = 1LL*c*i*p+d;
        suma = 0;
        while (n) {
            suma += n%b;
            n/=b;
        }
        if (suma == sol) {
            cout<<i*p<<" ";
            m--;
        }
        ///}
    }


}
# Verdict Execution time Memory Grader output
1 Correct 1643 ms 696 KB Output is correct
2 Execution timed out 2001 ms 504 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2033 ms 404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2088 ms 416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2051 ms 544 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2064 ms 404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2028 ms 532 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 109 ms 440 KB Output is correct
2 Correct 1212 ms 1548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2076 ms 1748 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1222 ms 2448 KB Output is correct
2 Correct 1407 ms 3192 KB Output is correct
3 Correct 1581 ms 3028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2050 ms 524 KB Time limit exceeded
2 Halted 0 ms 0 KB -