18812022-12-06 22:32:03TomaSajtSorozat generáláscpp17Wrong answer 15/5041ms13144 KiB
#include <bits/stdc++.h>
#define speed ios::sync_with_stdio(0);cin.tie(0)
using namespace std;

int pows[13] = { 1 };
int main() {
    speed;
    int m, x, a, b, n, k;
    cin >> m >> x >> a >> b >> n >> k;
    for (int i = 1; i <= 12; i++) pows[i] = pows[i - 1] * 10;
    multiset<int> s;
    int r = -1;
    for (int i = 0; i < n; i++) {
        x = ((a * x + b) / pows[m]) % pows[2 * m];
        s.insert(x);
        if (r == -1 && s.count(x) == 2) r = x;
    }
    cout << r << '\n' << *next(s.rbegin(), k - 1);
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/03ms1976 KiB
2Wrong answer0/032ms11604 KiB
3Partially correct1/22ms2328 KiB
4Partially correct1/23ms3016 KiB
5Partially correct1/23ms3224 KiB
6Partially correct1/23ms3120 KiB
7Partially correct1/24ms3540 KiB
8Partially correct2/44ms3800 KiB
9Partially correct2/47ms4748 KiB
10Partially correct2/417ms7628 KiB
11Partially correct2/420ms7828 KiB
12Partially correct2/424ms9860 KiB
13Wrong answer0/427ms11840 KiB
14Wrong answer0/429ms12000 KiB
15Wrong answer0/441ms13036 KiB
16Wrong answer0/437ms13108 KiB
17Wrong answer0/428ms13144 KiB