205802026-01-07 18:26:17ZsoltSorozat generáláscpp17Wrong answer 30/5041ms1016 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[i]=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;
    cout<<mintav<<endl;
    cout<<*it;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/50
1Accepted0/01ms508 KiB
2Wrong answer0/041ms1016 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms316 KiB
8Accepted4/42ms316 KiB
9Accepted4/46ms324 KiB
10Accepted4/46ms624 KiB
11Accepted4/46ms564 KiB
12Accepted4/416ms564 KiB
13Wrong answer0/424ms780 KiB
14Wrong answer0/434ms844 KiB
15Wrong answer0/417ms876 KiB
16Wrong answer0/429ms908 KiB
17Wrong answer0/439ms1004 KiB