Submission #145058

# Submission time Handle Problem Language Result Execution time Memory
145058 2019-08-18T15:43:32 Z Linca_Robert Kotrljanje (COCI18_kotrljanje) C++14
140 / 140
1106 ms 18648 KB
#include<bits/stdc++.h>
using namespace std;
const int DIM = 1e5;

int C, D, B, M;
long long curr, aux;
vector<long long> arr[DIM];

inline int suma( long long x ){
    int s = 0;
    while( x != 0 ){
        s += x % B;
        x /= B;
    }
    return s;
}
int main(){

    cin >> C >> D >> B >> M;
    aux = 1LL * C * (B - 1);
    curr = aux + D;
    for( int i = 1; ; i++ ){
        int s = suma( curr );
        arr[s].push_back( i );
        if( arr[s].size() == M ){
            for( int j = 0; j < arr[s].size(); j++ )
                cout << 1LL * arr[s][j] * (B - 1) << " ";
            break;
        }
        curr += aux;
    }
    return 0;
}

Compilation message

kotrljanje.cpp: In function 'int main()':
kotrljanje.cpp:25:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if( arr[s].size() == M ){
             ~~~~~~~~~~~~~~^~~~
kotrljanje.cpp:26:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for( int j = 0; j < arr[s].size(); j++ )
                             ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2808 KB Output is correct
2 Correct 83 ms 9244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 7580 KB Output is correct
2 Correct 58 ms 8160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 7524 KB Output is correct
2 Correct 62 ms 8292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 8548 KB Output is correct
2 Correct 69 ms 8248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 65 ms 8608 KB Output is correct
2 Correct 133 ms 9160 KB Output is correct
3 Correct 83 ms 8532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 77 ms 8788 KB Output is correct
2 Correct 66 ms 8292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 41 ms 3576 KB Output is correct
2 Correct 435 ms 9060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 975 ms 16812 KB Output is correct
2 Correct 666 ms 18420 KB Output is correct
3 Correct 1106 ms 18648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 123 ms 9944 KB Output is correct
2 Correct 538 ms 14952 KB Output is correct
3 Correct 76 ms 9140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 8288 KB Output is correct
2 Correct 63 ms 7660 KB Output is correct