207992026-01-09 09:50:01AsztalosssssMunkákcpp17Runtime error 0/802ms760 KiB
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

struct munka{int sorszam, nap, bev, ellenor;};
munka v[100000];
struct igazimunka{int sorszam2, nap2, bev2;};
igazimunka v2[100000];

int main()
{
    ifstream f("bemenet.txt");
    int N,M;
    f>>N;
    f>>M;
    for (int i=1; i<=M; i++)
    {
        v[i].sorszam=i;
        f>>v[i].nap;
        f>>v[i].bev;
        v[i].ellenor=1;
    }
    for (int i=1; i<=M; i++)
    {
        cout << v[i].sorszam << " " << v[i].nap << " " << v[i].bev << " " << v[i].ellenor << endl;
    }
    for (int i=1; i<=M-1; i++)
    {
        for (int j=i+1; j<=M; j++)
        {
            if (v[i].bev<v[j].bev)
            {
                swap(v[i],v[j]);
            }
        }
    }
    cout << endl;
    for (int i=1; i<=M; i++)
    {
        cout << v[i].sorszam << " " << v[i].nap << " " << v[i].bev << " " << v[i].ellenor << endl;
    }
    int sorszam[M]={0};
    int s=0,db=0,j=1;
    bool igaz=true;
    s+=v[1].bev;
    db++;
    sorszam[j]=v[1].sorszam;
    j++;
    for (int i=2; i<=M; i++)
    {
        for (int k=i-1; k>=1; k--)
        {
            if(v[k].nap==v[i].nap-1||v[i].nap==v[k].nap-1)
            {
                igaz=false;
            }
        }
        if(!igaz)
        {
            v[i].ellenor=0;
            v[i].nap=-1;
        }
        igaz=true;
    }
    for (int i=1; i<=M; i++)
    {
        cout << v[i].sorszam << " " << v[i].nap << " " << v[i].bev << " " << v[i].ellenor << endl;
    }
    for (int i=2; i<=M; i++)
    {
        if (v[i].ellenor!=0)
        {
            s+=v[i].bev;
            db++;
            sorszam[j]=v[i].sorszam;
            j++;
        }
    }
    for (int i=1; i<=M; i++)
    {
        cout << v[i].sorszam << " " << v[i].nap << " " << v[i].bev << " " << v[i].ellenor << endl;
    }
    ofstream g("kimenet.txt");
    g<<s<<" "<<db<<endl;
    int mini=INT_MAX,minihely;
    for (int i=0; i<j; i++)
    {
        mini=sorszam[i];
        minihely=i;
        for (int k=i+1; k<j; k++)
        {
            if (mini>sorszam[k])
            {
                mini=sorszam[k];
                minihely=k;
            }
        }
        swap(sorszam[minihely],sorszam[i]);
    }

    for (int i=1; i<j; i++)
    {
        cout<<sorszam[i]<<" ";
    }
    for (int i=1; i<j; i++)
    {
        g<<sorszam[i]<<" ";
    }


    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Runtime error1ms500 KiB
2Runtime error1ms316 KiB
subtask20/10
3Runtime error2ms316 KiB
4Runtime error2ms564 KiB
5Runtime error2ms316 KiB
6Runtime error2ms428 KiB
7Runtime error1ms508 KiB
subtask30/10
8Runtime error1ms492 KiB
9Runtime error1ms564 KiB
10Runtime error1ms508 KiB
11Runtime error1ms500 KiB
12Runtime error2ms508 KiB
subtask40/10
13Runtime error2ms316 KiB
14Runtime error2ms564 KiB
15Runtime error2ms316 KiB
16Runtime error2ms428 KiB
17Runtime error1ms508 KiB
18Runtime error1ms512 KiB
19Runtime error1ms316 KiB
20Runtime error1ms316 KiB
21Runtime error1ms316 KiB
22Runtime error1ms316 KiB
subtask50/10
23Runtime error1ms492 KiB
24Runtime error1ms564 KiB
25Runtime error1ms508 KiB
26Runtime error1ms500 KiB
27Runtime error2ms508 KiB
28Runtime error2ms500 KiB
29Runtime error2ms316 KiB
30Runtime error2ms316 KiB
31Runtime error1ms512 KiB
32Runtime error1ms316 KiB
subtask60/10
33Runtime error2ms316 KiB
34Runtime error2ms564 KiB
35Runtime error2ms316 KiB
36Runtime error2ms428 KiB
37Runtime error1ms508 KiB
38Runtime error1ms492 KiB
39Runtime error1ms564 KiB
40Runtime error1ms508 KiB
41Runtime error1ms500 KiB
42Runtime error2ms508 KiB
43Runtime error1ms512 KiB
44Runtime error1ms316 KiB
45Runtime error1ms316 KiB
46Runtime error1ms316 KiB
47Runtime error1ms316 KiB
48Runtime error2ms500 KiB
49Runtime error2ms316 KiB
50Runtime error2ms316 KiB
51Runtime error1ms512 KiB
52Runtime error1ms316 KiB
53Runtime error1ms316 KiB
54Runtime error1ms548 KiB
55Runtime error1ms316 KiB
56Runtime error1ms316 KiB
57Runtime error1ms316 KiB
subtask70/10
58Runtime error2ms316 KiB
59Runtime error2ms564 KiB
60Runtime error2ms316 KiB
61Runtime error2ms428 KiB
62Runtime error1ms508 KiB
63Runtime error1ms492 KiB
64Runtime error1ms564 KiB
65Runtime error1ms508 KiB
66Runtime error1ms500 KiB
67Runtime error2ms508 KiB
68Runtime error1ms512 KiB
69Runtime error1ms316 KiB
70Runtime error1ms316 KiB
71Runtime error1ms316 KiB
72Runtime error1ms316 KiB
73Runtime error2ms500 KiB
74Runtime error2ms316 KiB
75Runtime error2ms316 KiB
76Runtime error1ms512 KiB
77Runtime error1ms316 KiB
78Runtime error1ms316 KiB
79Runtime error1ms548 KiB
80Runtime error1ms316 KiB
81Runtime error1ms316 KiB
82Runtime error1ms316 KiB
83Runtime error1ms316 KiB
84Runtime error1ms512 KiB
85Runtime error1ms316 KiB
86Runtime error1ms316 KiB
87Runtime error1ms316 KiB
subtask80/20
88Runtime error2ms316 KiB
89Runtime error2ms564 KiB
90Runtime error2ms316 KiB
91Runtime error2ms428 KiB
92Runtime error1ms508 KiB
93Runtime error1ms492 KiB
94Runtime error1ms564 KiB
95Runtime error1ms508 KiB
96Runtime error1ms500 KiB
97Runtime error2ms508 KiB
98Runtime error1ms512 KiB
99Runtime error1ms316 KiB
100Runtime error1ms316 KiB
101Runtime error1ms316 KiB
102Runtime error1ms316 KiB
103Runtime error2ms500 KiB
104Runtime error2ms316 KiB
105Runtime error2ms316 KiB
106Runtime error1ms512 KiB
107Runtime error1ms316 KiB
108Runtime error1ms316 KiB
109Runtime error1ms548 KiB
110Runtime error1ms316 KiB
111Runtime error1ms316 KiB
112Runtime error1ms316 KiB
113Runtime error1ms316 KiB
114Runtime error1ms512 KiB
115Runtime error1ms316 KiB
116Runtime error1ms316 KiB
117Runtime error1ms316 KiB
118Runtime error1ms316 KiB
119Runtime error1ms760 KiB
120Runtime error1ms500 KiB
121Runtime error1ms316 KiB
122Runtime error1ms500 KiB
123Runtime error1ms316 KiB
124Runtime error1ms316 KiB
125Runtime error1ms316 KiB
126Runtime error1ms316 KiB
127Runtime error1ms316 KiB