Submission #77650

# Submission time Handle Problem Language Result Execution time Memory
77650 2018-09-29T10:03:23 Z ccinv Kotrljanje (COCI18_kotrljanje) C++14
126 / 140
1075 ms 10888 KB
#include <bits/stdc++.h>
using namespace std;

#define oo 0x3f3f3f3f
#define mp make_pair
#define fi first
#define se second
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define FO(i,a,b) for (int i=(a);i<=(b);++i)
#define FD(i,a,b) for (int i=(a);i>=(b);--i)
#define FE(i,G,x) for(int i=(G).h[x];~i;i=(G).v[i].nxt)
typedef long long LL;
typedef pair<int, int> PII;

template <class T> inline bool chkmin(T& x, T y) { return x > y ? x = y, true : false; }
template <class T> inline bool chkmax(T& x, T y) { return x < y ? x = y, true : false; }

inline LL read(void) {
    LL x, f = 1; char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (x = 0; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
    return x * f;
}

int c, d, b, m;
vector<int> A[50100];

int get(LL x) {
    int r = 0;
    while (x) r += x % b, x /= b;
    return r;
}

int main(void) {
    c = read(), d = read(), b = read(), m = read();
    FO(i, 1, 1e9){
        int pp = get(1ll * c * (b - 1) * i + d) / (b - 1);
        A[pp].push_back(i);
        if (A[pp].size() == m){
            for (auto x: A[pp]) printf("%d ",x * (b - 1));
            return 0;
        }
    }
    return 0;
}

Compilation message

kotrljanje.cpp: In function 'int main()':
kotrljanje.cpp:39:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (A[pp].size() == m){
             ~~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1656 KB Output is correct
2 Incorrect 73 ms 6464 KB Expected unsigned integer, but "-2147481660" found
# Verdict Execution time Memory Grader output
1 Correct 53 ms 6464 KB Output is correct
2 Correct 49 ms 6464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 6464 KB Output is correct
2 Correct 53 ms 6464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 6464 KB Output is correct
2 Correct 63 ms 6464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 6464 KB Output is correct
2 Correct 121 ms 6464 KB Output is correct
3 Correct 71 ms 6464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 66 ms 6464 KB Output is correct
2 Correct 56 ms 6464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 6464 KB Output is correct
2 Correct 425 ms 6464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 970 ms 9940 KB Output is correct
2 Correct 644 ms 10836 KB Output is correct
3 Correct 1075 ms 10888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 10888 KB Output is correct
2 Correct 515 ms 10888 KB Output is correct
3 Correct 67 ms 10888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 10888 KB Output is correct
2 Correct 60 ms 10888 KB Output is correct