18992022-12-08 10:11:56szabel26Ludak Harcacpp17Wrong answer 0/10032ms5524 KiB
/*
Kod Kupa Online Selejtezo - Ludak Harca Feladat
Megoldas: O(n^2)
Alapotlet: Lepesenkent "vegigjatsszuk" a tarsast, kulombozo dobokocka ertekekkel.
        A szukseges dobasok szamat egy valtozoval figyeljuk, amit majd egy vektorba
        beteszunk majd kiirjuk a vektor elemeit.
*/

#include <iostream>
//#include <fstream>
#include <vector>

using namespace std;

//ifstream cin("tarsas.in");
//ofstream cout("tarsas.out");

int n,j,dk,i,a,lepesdb;

vector <int>x;
vector <int>lepes;

int main()
{
    cin>>n;
    for(i=1;i<=n;++i)
    {
        cin>>a;
        x.push_back(a);
    }
    for(dk=1;dk<=6;++dk)
    {
        i=0;
        lepesdb=0;
        while(i<n)
            {
                i+=dk;
                ++lepesdb;
                if(x[i]!=0) i+=x[i];
                    else{
                        i+=dk;
                        ++lepesdb;
                    }
            }
        lepes.push_back(lepesdb);
    }
    for(auto &e:lepes) cout<<e<<" ";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer3ms1880 KiB
2Wrong answer2ms2000 KiB
subtask20/25
3Wrong answer2ms2244 KiB
4Wrong answer2ms2492 KiB
5Wrong answer2ms2704 KiB
6Wrong answer4ms3088 KiB
7Wrong answer19ms4020 KiB
subtask30/40
8Wrong answer2ms3112 KiB
9Wrong answer3ms3200 KiB
10Wrong answer4ms3548 KiB
11Wrong answer7ms3752 KiB
12Wrong answer12ms4344 KiB
13Wrong answer19ms4784 KiB
14Wrong answer25ms4944 KiB
15Wrong answer28ms4928 KiB
subtask40/35
16Wrong answer4ms4280 KiB
17Wrong answer7ms4420 KiB
18Wrong answer10ms4828 KiB
19Wrong answer13ms4944 KiB
20Wrong answer14ms5012 KiB
21Wrong answer18ms5016 KiB
22Wrong answer23ms5516 KiB
23Wrong answer26ms5520 KiB
24Wrong answer25ms5516 KiB
25Wrong answer32ms5524 KiB