답안 #144210

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
144210 2019-08-16T10:01:38 Z AldeaDanut Kotrljanje (COCI18_kotrljanje) C++14
112 / 140
2000 ms 5772 KB
#include <iostream>
#include <vector>
using namespace std;

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

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

    if(b<5000 && c<10000){
        x=3;
        while(true){
            n=c*x+d;
            sum=0;
            while(n){
                sum+=n%b;
                n/=b;
            }
            f[sum]++;

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

        x=3;
        while(m){
            n=c*x+d;
            sum=0;
            while(n){
                sum+=n%b;
                n/=b;
            }

            if(sum==sol){
                cout<<x<<" ";
                m--;
            }
            x+=b-1;
        }
    }else{
        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:56:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(v[sum].size()==m){
                ~~~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1016 KB Output is correct
2 Incorrect 80 ms 5772 KB Expected unsigned integer, but "-2147481657" found
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 3148 KB Output is correct
2 Correct 67 ms 3192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 70 ms 3180 KB Output is correct
2 Correct 84 ms 3192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 90 ms 3344 KB Output is correct
2 Correct 72 ms 3320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 3532 KB Output is correct
2 Correct 223 ms 2808 KB Output is correct
3 Correct 100 ms 3320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 84 ms 3448 KB Output is correct
2 Correct 86 ms 3576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 1116 KB Output is correct
2 Correct 811 ms 1868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1832 ms 2808 KB Output is correct
2 Correct 1211 ms 2936 KB Output is correct
3 Execution timed out 2033 ms 2452 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Correct 188 ms 2992 KB Output is correct
2 Correct 1071 ms 3064 KB Output is correct
3 Correct 95 ms 3448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 5100 KB Output is correct
2 Correct 92 ms 2936 KB Output is correct