225072026-01-15 10:10:09badamSorozat generáláscpp17Wrong answer 10/5018ms1568 KiB
#include <bits/stdc++.h>

using namespace std;
struct szam{int ertek, sorszam;};
bool h(szam a, szam b)
{
    return a.ertek<b.ertek;
}
int main()
{
    int M, curr, A, B, N, K;
    cin >> M >> curr >> A >> B >> N >> K;
    int v[N];
    for(int i=0;i<N;i++)
    {
        int x=A*curr+B;
        int y=pow(10,3*M);
        int z=pow(10,M);
        x=x%y;
        x=x/z;
        v[i]=x;
        curr=x;
    }
    szam t[N];
    for(int i=0;i<N;i++)
    {
        t[i].ertek=v[i];
        t[i].sorszam=i;
    }
    sort(t,t+N,h);
    int  min_tavolsag=2000000, curr_tavolsag;
    for(int i=1;i<N;i++)
    {
        if(t[i].ertek==t[i-1].ertek)
        {
            curr_tavolsag=abs(t[i].sorszam-t[i-1].sorszam);
        }
        if(curr_tavolsag<min_tavolsag) min_tavolsag=curr_tavolsag;
    }
    cout << min_tavolsag << endl;
    cout << t[K].ertek;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base10/50
1Wrong answer0/01ms316 KiB
2Wrong answer0/018ms1332 KiB
3Partially correct1/21ms316 KiB
4Partially correct1/22ms316 KiB
5Partially correct1/21ms316 KiB
6Partially correct1/21ms316 KiB
7Accepted2/22ms316 KiB
8Wrong answer0/43ms512 KiB
9Partially correct2/44ms564 KiB
10Partially correct2/48ms836 KiB
11Wrong answer0/48ms980 KiB
12Wrong answer0/412ms1220 KiB
13Wrong answer0/416ms1456 KiB
14Wrong answer0/416ms1452 KiB
15Wrong answer0/416ms1512 KiB
16Wrong answer0/417ms1552 KiB
17Wrong answer0/417ms1568 KiB