19002022-12-08 10:14:42szabel26Ludak Harcacpp17Wrong answer 0/10032ms5532 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 answer2ms2212 KiB
subtask20/25
3Wrong answer2ms2220 KiB
4Wrong answer2ms2468 KiB
5Wrong answer2ms2552 KiB
6Wrong answer4ms2980 KiB
7Wrong answer19ms4148 KiB
subtask30/40
8Wrong answer2ms3412 KiB
9Wrong answer3ms3436 KiB
10Wrong answer4ms3600 KiB
11Wrong answer7ms3868 KiB
12Wrong answer12ms4256 KiB
13Wrong answer19ms4836 KiB
14Wrong answer25ms4900 KiB
15Wrong answer27ms4904 KiB
subtask40/35
16Wrong answer4ms4048 KiB
17Wrong answer7ms4084 KiB
18Wrong answer9ms4196 KiB
19Wrong answer13ms4516 KiB
20Wrong answer14ms4592 KiB
21Wrong answer18ms4632 KiB
22Wrong answer21ms5148 KiB
23Wrong answer26ms5320 KiB
24Wrong answer25ms5532 KiB
25Wrong answer32ms5524 KiB