Submission #141365

# Submission time Handle Problem Language Result Execution time Memory
141365 2019-08-07T15:05:19 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 = 1;
    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 = 1;
    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 83 ms 2448 KB Output is correct
2 Correct 75 ms 2424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 89 ms 2616 KB Output is correct
2 Correct 85 ms 2552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 2552 KB Output is correct
2 Correct 75 ms 2588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 2680 KB Output is correct
2 Correct 201 ms 2168 KB Output is correct
3 Correct 101 ms 2680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 78 ms 2808 KB Output is correct
2 Correct 96 ms 2808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 504 KB Output is correct
2 Correct 806 ms 1036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1819 ms 1768 KB Output is correct
2 Correct 1206 ms 2168 KB Output is correct
3 Execution timed out 2052 ms 2020 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 165 ms 2324 KB Output is correct
2 Correct 992 ms 2368 KB Output is correct
3 Correct 96 ms 2808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 2760 KB Output is correct
2 Correct 93 ms 2296 KB Output is correct