195762025-12-16 09:31:06gkataDíjazás több helyezettnekcpp17Wrong answer 5/80588ms564 KiB

// dijazas.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include<queue>

using namespace std;

int n, p, m, s=0, mx, mn;
vector<int>x;

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

void back(int k)
{
    /*mx = n - ((p - 1) * p) / 2;
    mn = mx / p + p - 1;*/
    for (int i = x[k - 1] + 1; i <= n - ((p - 1) * p) / 2; ++i)
    {
        if (s + i <= n)
        {

            x[k] = i;
            s += i;
            if (k == p)
            {
                if(s==n) kiir(k);
            }
            else
                back(k + 1);
            s -= i;
        }
    }
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> p >> n;
    x.resize(p + 1);

    back(1);
}

// 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
2Wrong answer10ms508 KiB
subtask25/5
3Accepted1ms508 KiB
4Accepted1ms316 KiB
5Accepted1ms396 KiB
6Accepted1ms508 KiB
7Accepted1ms316 KiB
subtask30/5
8Accepted1ms316 KiB
9Accepted1ms316 KiB
10Wrong answer1ms316 KiB
11Wrong answer1ms564 KiB
12Wrong answer3ms316 KiB
subtask40/15
13Accepted1ms316 KiB
14Wrong answer1ms316 KiB
15Wrong answer1ms316 KiB
16Wrong answer1ms316 KiB
17Wrong answer3ms316 KiB
subtask50/15
18Accepted1ms316 KiB
19Wrong answer2ms316 KiB
20Wrong answer2ms316 KiB
21Wrong answer3ms316 KiB
22Wrong answer1ms316 KiB
subtask60/15
23Accepted1ms316 KiB
24Wrong answer10ms428 KiB
25Accepted1ms316 KiB
26Wrong answer2ms316 KiB
27Wrong answer2ms316 KiB
28Wrong answer3ms316 KiB
29Wrong answer1ms316 KiB
30Wrong answer6ms508 KiB
31Wrong answer6ms316 KiB
32Accepted1ms508 KiB
33Wrong answer2ms316 KiB
34Wrong answer16ms316 KiB
35Accepted1ms316 KiB
36Wrong answer4ms560 KiB
37Wrong answer35ms500 KiB
38Wrong answer89ms448 KiB
39Wrong answer10ms316 KiB
subtask70/25
40Accepted1ms316 KiB
41Wrong answer10ms428 KiB
42Accepted1ms508 KiB
43Accepted1ms316 KiB
44Accepted1ms396 KiB
45Accepted1ms508 KiB
46Accepted1ms316 KiB
47Accepted1ms316 KiB
48Accepted1ms316 KiB
49Wrong answer1ms316 KiB
50Wrong answer1ms564 KiB
51Wrong answer3ms316 KiB
52Accepted1ms316 KiB
53Wrong answer1ms316 KiB
54Wrong answer1ms316 KiB
55Wrong answer1ms316 KiB
56Wrong answer3ms316 KiB
57Accepted1ms316 KiB
58Wrong answer2ms316 KiB
59Wrong answer2ms316 KiB
60Wrong answer3ms316 KiB
61Wrong answer1ms316 KiB
62Wrong answer6ms508 KiB
63Wrong answer6ms316 KiB
64Accepted1ms508 KiB
65Wrong answer2ms316 KiB
66Wrong answer16ms316 KiB
67Accepted1ms316 KiB
68Wrong answer4ms560 KiB
69Wrong answer35ms500 KiB
70Wrong answer89ms448 KiB
71Wrong answer10ms316 KiB
72Time limit exceeded588ms500 KiB
73Wrong answer79ms508 KiB
74Time limit exceeded588ms316 KiB
75Accepted3ms316 KiB
76Accepted19ms316 KiB
77Time limit exceeded578ms500 KiB
78Accepted10ms512 KiB
79Time limit exceeded587ms316 KiB
80Wrong answer481ms316 KiB
81Time limit exceeded570ms500 KiB