Submission #141175

# Submission time Handle Problem Language Result Execution time Memory
141175 2019-08-07T05:31:45 Z mariusnicoli Kotrljanje (COCI18_kotrljanje) C++14
28 / 140
1833 ms 65540 KB
#include <iostream>
#include <vector>
#include <map>

using namespace std;
map<int, vector<long long>> mp;
long long c, d, b, m, p, i, n, suma;

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;
        }
        ///if (mp.find(suma) == mp.end()) {
        mp[suma].push_back(i*p);
        if (mp[suma].size() == m) {
            for (int i=0;i<mp[suma].size();i++)
                cout<<mp[suma][i]<<" ";
            return 0;
        }
        ///}
    }
}

Compilation message

kotrljanje.cpp: In function 'int main()':
kotrljanje.cpp:24:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (mp[suma].size() == m) {
             ~~~~~~~~~~~~~~~~^~~~
kotrljanje.cpp:25:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int i=0;i<mp[suma].size();i++)
                          ~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1833 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1595 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1660 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1792 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1650 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1729 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 59 ms 1268 KB Output is correct
2 Correct 645 ms 7612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1375 ms 14984 KB Output is correct
2 Correct 1018 ms 16232 KB Output is correct
3 Correct 1613 ms 18424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 780 ms 40324 KB Output is correct
2 Correct 775 ms 13448 KB Output is correct
3 Runtime error 944 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
# Verdict Execution time Memory Grader output
1 Runtime error 1808 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -