Submission #144224

# Submission time Handle Problem Language Result Execution time Memory
144224 2019-08-16T10:11:54 Z AldeaDanut Kotrljanje (COCI18_kotrljanje) C++14
140 / 140
1110 ms 17264 KB
#include <iostream>
#include <vector>
using namespace std;

long long n,c,d,b,m,x,i,sum,sol;
int f[30000];
vector <long long> 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<v[sol].size();i++)
        cout<<v[sol][i]<<" ";


    return 0;
}

Compilation message

kotrljanje.cpp: In function 'int main()':
kotrljanje.cpp:22:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(v[sum].size()==m){
            ~~~~~~~~~~~~~^~~
kotrljanje.cpp:29:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(i=0;i<v[sol].size();i++)
             ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1272 KB Output is correct
2 Correct 82 ms 7640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 5700 KB Output is correct
2 Correct 55 ms 5732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 6472 KB Output is correct
2 Correct 60 ms 5984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 71 ms 6572 KB Output is correct
2 Correct 60 ms 6244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 7096 KB Output is correct
2 Correct 167 ms 8564 KB Output is correct
3 Correct 77 ms 6756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 6736 KB Output is correct
2 Correct 73 ms 6740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 1916 KB Output is correct
2 Correct 439 ms 7576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 979 ms 15100 KB Output is correct
2 Correct 671 ms 16924 KB Output is correct
3 Correct 1110 ms 17264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 116 ms 8168 KB Output is correct
2 Correct 562 ms 13232 KB Output is correct
3 Correct 77 ms 7400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 78 ms 6504 KB Output is correct
2 Correct 76 ms 5992 KB Output is correct