Submission #141366

# Submission time Handle Problem Language Result Execution time Memory
141366 2019-08-07T15:10:13 Z mariusnicoli Kotrljanje (COCI18_kotrljanje) C++14
126 / 140
2000 ms 2936 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;
    long long x = 3;
    for (i=1;;i++) {
        n = c*x+d;
        suma = 0;
        while (n) {
            suma += n%b;
            n/=b;
        }

        mp[suma] ++;

        if (mp[suma] == m) {
            sol = suma;
            break;
        }
        x += (b-1);
    }
    x = 3;
    for (i=1;m;i++) {
        n = c*x+d;
        suma = 0;
        while (n) {
            suma += n%b;
            n/=b;
        }
        if (suma == sol) {
            cout<<x<<" ";
            m--;
        }
        x += (b-1);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 376 KB Output is correct
2 Correct 98 ms 2936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 2300 KB Output is correct
2 Correct 65 ms 2552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 2424 KB Output is correct
2 Correct 70 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 83 ms 2652 KB Output is correct
2 Correct 72 ms 2680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 91 ms 2680 KB Output is correct
2 Correct 223 ms 2292 KB Output is correct
3 Correct 100 ms 2808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 84 ms 2808 KB Output is correct
2 Correct 87 ms 2936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 376 KB Output is correct
2 Correct 824 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1828 ms 1896 KB Output is correct
2 Correct 1217 ms 2268 KB Output is correct
3 Execution timed out 2035 ms 2004 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 162 ms 2296 KB Output is correct
2 Correct 996 ms 2152 KB Output is correct
3 Correct 95 ms 2808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 2680 KB Output is correct
2 Correct 94 ms 2296 KB Output is correct