Submission #141228

# Submission time Handle Problem Language Result Execution time Memory
141228 2019-08-07T07:14:16 Z mariusnicoli Kotrljanje (COCI18_kotrljanje) C++14
28 / 140
2000 ms 3072 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*b+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*b+d;
        suma = 0;
        while (n) {
            suma += n%b;
            n/=b;
        }
        if (suma == sol) {
            cout<<i*b<<" ";
            m--;
        }
        ///}
    }


}
# Verdict Execution time Memory Grader output
1 Correct 1232 ms 472 KB Output is correct
2 Execution timed out 2011 ms 420 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 2079 ms 408 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2073 ms 412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2017 ms 408 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2020 ms 408 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2021 ms 412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 73 ms 400 KB Output is correct
2 Correct 823 ms 1032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1897 ms 1872 KB Output is correct
2 Correct 1221 ms 2160 KB Output is correct
3 Execution timed out 2066 ms 1976 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 1242 ms 2540 KB Output is correct
2 Correct 1002 ms 2160 KB Output is correct
3 Correct 1578 ms 3072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2071 ms 408 KB Time limit exceeded
2 Halted 0 ms 0 KB -