63612023-11-23 20:26:22MrChipserSorozat generáláscpp11Wrong answer 16/5075ms5800 KiB
#include <iostream>
#include <vector>
#include <cmath>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int m,x,a,b,n,k;
    vector<long> sorozat;
    cin >> m >> x >> a >> b >> n >> k;
    for(int i = 0; i <n; i++)
    {
        long long c = x*a+b;
        //cout << c << endl;
        vector<long long>akt;
        //cout << c << endl;
        while(c!=0)
        {
            akt.insert(akt.begin(),c%10);
            c/=10;
        }
        if(akt.size()!=4*m)
        {
            while(akt.size()!=4*m)
                akt.insert(akt.begin(),0);
        }
        int d=0;
        int szorzo = pow(10,2*m-1);
        for(int i = 0; i < 2*m; i++)
        {
            d+=szorzo*akt[4*m-2*m-m+i];
            szorzo/=10;
        }
        sorozat.push_back(d);
        x=d;
    }
    //for(int i = 0; i < sorozat.size(); i++)
        //cout << sorozat[i] << " ";
    int mintav = n;
    map<int,int>hmap;
    int elozo=0,akt=0;
    for(int i = 0; i <sorozat.size(); i++)
    {
        if(hmap.find(sorozat[i])!=hmap.end())
        {
            akt = i;
            elozo = hmap[sorozat[i]];
            if(akt-elozo < mintav)
                mintav = akt-elozo;
        }
        hmap[sorozat[i]]=i;

    }
    cout << mintav << endl;
    sort(sorozat.begin(),sorozat.end());
    cout << sorozat[k];
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base16/50
1Accepted0/03ms1812 KiB
2Wrong answer0/075ms4072 KiB
3Partially correct1/23ms2276 KiB
4Partially correct1/24ms2760 KiB
5Partially correct1/24ms2928 KiB
6Partially correct1/23ms3088 KiB
7Accepted2/24ms3364 KiB
8Partially correct2/44ms3584 KiB
9Partially correct2/410ms4044 KiB
10Partially correct2/419ms4728 KiB
11Partially correct2/418ms4764 KiB
12Partially correct2/432ms5728 KiB
13Wrong answer0/454ms5660 KiB
14Wrong answer0/464ms5656 KiB
15Wrong answer0/448ms5656 KiB
16Wrong answer0/461ms5668 KiB
17Wrong answer0/471ms5800 KiB