Submission #144192

# Submission time Handle Problem Language Result Execution time Memory
144192 2019-08-16T09:49:19 Z AldeaDanut Kotrljanje (COCI18_kotrljanje) C++14
126 / 140
1095 ms 9880 KB
#include <iostream>
#include <vector>
using namespace std;

long long n,c,d,b,m,x,i,sum,sol;
vector <int> v[30000];

int main(){
    cin>>c>>d>>b>>m;

    x=3;
    while(true){
        n=c*x+d;
        sum=0;
        while(n){
            sum+=n%b;
            n/=b;
        }
        v[sum].push_back(x);

        if(v[sum].size()==m){
            sol=sum;
            break;
        }
        x+=b-1;
    }

    for(i=0;i<m;i++)
        cout<<v[sol][i]<<" ";

    return 0;
}

Compilation message

kotrljanje.cpp: In function 'int main()':
kotrljanje.cpp:21:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(v[sum].size()==m){
            ~~~~~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1148 KB Output is correct
2 Incorrect 79 ms 5748 KB Expected unsigned integer, but "-2147481657" found
# Verdict Execution time Memory Grader output
1 Correct 58 ms 4364 KB Output is correct
2 Correct 56 ms 4456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 4844 KB Output is correct
2 Correct 57 ms 4588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 5104 KB Output is correct
2 Correct 58 ms 4972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 73 ms 5344 KB Output is correct
2 Correct 142 ms 5648 KB Output is correct
3 Correct 75 ms 5100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 5084 KB Output is correct
2 Correct 71 ms 5344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 1400 KB Output is correct
2 Correct 431 ms 4668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 964 ms 9020 KB Output is correct
2 Correct 682 ms 9880 KB Output is correct
3 Correct 1095 ms 9780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 5592 KB Output is correct
2 Correct 543 ms 8504 KB Output is correct
3 Correct 74 ms 5500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 4960 KB Output is correct
2 Correct 71 ms 4560 KB Output is correct