194322025-12-09 10:41:35szabel26Díjazás több helyezettnekcpp17Time limit exceeded 5/80592ms556 KiB
// nemes_dijazas.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;

vector<int>x;
vector<int>st;
int h, e, maxi;

void kiir()
{
    for (int i = h; i >= 1; --i)
    {
        cout << x[i] << " ";
    }
    cout << endl;
}

void back(int lep, int ossz)
{
    if (lep == h)
    {
        if (x[lep - 1] < e - ossz)
        {
            x[lep] = e - ossz;
            kiir();
            return;
        }
    }
    else
    {
        for (int i = 1; i <= maxi; ++i)
        {
            if (st[i] == 0 && x[lep - 1] < i)
            {
                x[lep] = i;
                st[i] = 1;
                if (lep == h)
                {
                    x[lep] = e - ossz;
                    if (ossz + i == e) kiir();
                }
                else back(lep + 1, ossz + i);
                st[i] = 0;
            }
        }
    }
}

int main()
{
    cin >> h >> e;
    x.resize(h + 1);
    st.resize(e + 1);
    maxi = e - ((h - 1) * h) / 2;
    back(1, 0);
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms316 KiB
2Time limit exceeded587ms316 KiB
subtask25/5
3Accepted1ms316 KiB
4Accepted1ms316 KiB
5Accepted1ms316 KiB
6Accepted1ms508 KiB
7Accepted1ms316 KiB
subtask30/5
8Accepted2ms316 KiB
9Accepted2ms316 KiB
10Wrong answer1ms316 KiB
11Wrong answer2ms316 KiB
12Wrong answer2ms316 KiB
subtask40/15
13Accepted1ms316 KiB
14Wrong answer1ms316 KiB
15Wrong answer1ms508 KiB
16Wrong answer1ms316 KiB
17Wrong answer3ms316 KiB
subtask50/15
18Accepted1ms316 KiB
19Wrong answer4ms316 KiB
20Wrong answer8ms316 KiB
21Wrong answer24ms408 KiB
22Wrong answer14ms316 KiB
subtask60/15
23Accepted1ms316 KiB
24Time limit exceeded589ms316 KiB
25Accepted1ms316 KiB
26Wrong answer4ms316 KiB
27Wrong answer8ms316 KiB
28Wrong answer24ms408 KiB
29Wrong answer14ms316 KiB
30Wrong answer172ms416 KiB
31Wrong answer402ms556 KiB
32Accepted1ms316 KiB
33Wrong answer45ms316 KiB
34Time limit exceeded578ms316 KiB
35Accepted4ms316 KiB
36Wrong answer127ms316 KiB
37Time limit exceeded587ms512 KiB
38Time limit exceeded578ms316 KiB
39Wrong answer266ms316 KiB
subtask70/25
40Accepted1ms316 KiB
41Time limit exceeded589ms316 KiB
42Accepted1ms316 KiB
43Accepted1ms316 KiB
44Accepted1ms316 KiB
45Accepted1ms508 KiB
46Accepted1ms316 KiB
47Accepted2ms316 KiB
48Accepted2ms316 KiB
49Wrong answer1ms316 KiB
50Wrong answer2ms316 KiB
51Wrong answer2ms316 KiB
52Accepted1ms316 KiB
53Wrong answer1ms316 KiB
54Wrong answer1ms508 KiB
55Wrong answer1ms316 KiB
56Wrong answer3ms316 KiB
57Accepted1ms316 KiB
58Wrong answer4ms316 KiB
59Wrong answer8ms316 KiB
60Wrong answer24ms408 KiB
61Wrong answer14ms316 KiB
62Wrong answer172ms416 KiB
63Wrong answer402ms556 KiB
64Accepted1ms316 KiB
65Wrong answer45ms316 KiB
66Time limit exceeded578ms316 KiB
67Accepted4ms316 KiB
68Wrong answer127ms316 KiB
69Time limit exceeded587ms512 KiB
70Time limit exceeded578ms316 KiB
71Wrong answer266ms316 KiB
72Time limit exceeded591ms512 KiB
73Time limit exceeded592ms508 KiB
74Time limit exceeded592ms316 KiB
75Accepted14ms316 KiB
76Accepted194ms316 KiB
77Time limit exceeded583ms316 KiB
78Accepted104ms316 KiB
79Time limit exceeded578ms508 KiB
80Time limit exceeded578ms508 KiB
81Time limit exceeded586ms316 KiB