205722026-01-07 18:20:33SomogyiSorozat generáláscpp17Wrong answer 30/5045ms1388 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int m,x,a,b,n,k;
    cin >> m >> x >> a >> b >> n >> k;

    vector <int> v(n+1);
    map <int,int> tav;

    int hat=pow(10,m);
    int mintav=INT_MAX;
    for (int i=1; i<=n; i++)
    {
        x=x*a+b;
        x=(x/hat)%(hat*hat);
        v.push_back(x);
        if(tav.count(x))
        {
            if(mintav>i-tav[x])
            {
                mintav=i-tav[x];
            }
        }
        tav[x]=i;
    }

    sort(v.begin(),v.end());
    auto it=v.end()-k-1;
    cout << mintav << endl;
    cout << *it;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/045ms1196 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms492 KiB
8Accepted4/42ms316 KiB
9Accepted4/44ms564 KiB
10Accepted4/48ms828 KiB
11Accepted4/47ms624 KiB
12Accepted4/414ms820 KiB
13Wrong answer0/424ms1128 KiB
14Wrong answer0/435ms1076 KiB
15Wrong answer0/416ms1388 KiB
16Wrong answer0/429ms1196 KiB
17Wrong answer0/441ms1088 KiB