204792026-01-07 09:09:08BikficcSorozat generáláscpp17Wrong answer 15/5052ms4940 KiB
#include <iostream>
#include <math.h>
#include <set>
using namespace std;

int main()
{
    int m, x, a, b, n, k;
    cin >> m >> x >> a >> b >> n >> k;
    int p=pow(10, m);
    bool ok=false;
    multiset<int> h;
    for (int i=1; i<=n; i++)
    {
        x= x*a+b;
        x=(x/p)%(p*p);
        if (h.count(x) && !ok)
        {

            cout << x << " ";
            ok=true;
        }
        h.insert(x);
    }
    auto it=h.rbegin();
    advance(it,k-1);
    cout <<*it;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Accepted0/01ms316 KiB
2Wrong answer0/052ms4916 KiB
3Partially correct1/22ms316 KiB
4Partially correct1/23ms564 KiB
5Partially correct1/22ms564 KiB
6Partially correct1/21ms316 KiB
7Partially correct1/23ms772 KiB
8Partially correct2/43ms748 KiB
9Partially correct2/48ms1216 KiB
10Partially correct2/420ms2672 KiB
11Partially correct2/427ms2612 KiB
12Partially correct2/428ms3452 KiB
13Wrong answer0/439ms4576 KiB
14Wrong answer0/445ms4532 KiB
15Wrong answer0/452ms4924 KiB
16Wrong answer0/452ms4940 KiB
17Wrong answer0/445ms4916 KiB