162742025-04-20 09:22:29horkaÖsszegzésekcpp17Hibás válasz 24/1006ms856 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
#define pb push_back
#define sz(x) (int)x.size()
signed main()
{
    int n; cin>>n;
    vector<int> v(n+1);
    for(int i=1; i<=n; i++)
        cin>>v[i];
    int s=0;
    for(int i:v)
        s+=i;
    vector<int> el,ut=v,p{0,0};
    int ossz=0,ind=0;
    el.pb(0);
    for(int i=1; i<=n; i++)
        if(v[i]!=1) ind=i;
    for(int i=1; i<ind; i++)
        el.pb(v[i]);
    el.pb(v[ind]-1);
    ossz=1;
    for(int i=n; i>ind; i--)
        ossz+=v[i];
    el.pb(ossz);
    if(ind==0)
    {
        el=p;
    }
    if(n>1)
    {
        ut=v;
        ut[n-1]++;
        int x=ut[n]-1;
        ut.pop_back();
        for(int i=0; i<x; i++)
            ut.pb(1);
    }
    else ut=p;
    for(int i=1; i<sz(ut); i++)
        cout<<ut[i]<<" ";
    cout<<"\n";
    for(int i=1; i<sz(el); i++)
        cout<<el[i]<<" ";
    cout<<"\n";
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
subtask10/0
1Elfogadva1ms508 KiB
2Elfogadva1ms316 KiB
3Hibás válasz1ms316 KiB
subtask26/6
4Elfogadva1ms500 KiB
5Elfogadva1ms316 KiB
6Elfogadva1ms316 KiB
7Elfogadva1ms316 KiB
8Elfogadva1ms316 KiB
subtask33/6
9Részben helyes1ms508 KiB
10Részben helyes1ms500 KiB
11Részben helyes1ms316 KiB
12Részben helyes4ms564 KiB
13Részben helyes4ms564 KiB
subtask45/10
14Részben helyes1ms508 KiB
15Részben helyes1ms500 KiB
16Részben helyes1ms316 KiB
17Részben helyes4ms564 KiB
18Részben helyes4ms564 KiB
19Részben helyes1ms316 KiB
20Részben helyes1ms316 KiB
21Részben helyes6ms820 KiB
22Részben helyes6ms820 KiB
23Részben helyes6ms856 KiB
subtask55/10
24Részben helyes1ms316 KiB
25Részben helyes1ms316 KiB
26Részben helyes1ms356 KiB
27Részben helyes1ms316 KiB
28Részben helyes1ms316 KiB
subtask65/10
29Elfogadva1ms360 KiB
30Részben helyes1ms316 KiB
31Elfogadva1ms316 KiB
32Elfogadva1ms316 KiB
33Részben helyes1ms316 KiB
subtask70/58
34Elfogadva1ms316 KiB
35Elfogadva1ms316 KiB
36Hibás válasz1ms316 KiB
37Elfogadva1ms500 KiB
38Elfogadva1ms316 KiB
39Elfogadva1ms316 KiB
40Elfogadva1ms316 KiB
41Elfogadva1ms316 KiB
42Részben helyes1ms508 KiB
43Részben helyes1ms500 KiB
44Részben helyes1ms316 KiB
45Részben helyes4ms564 KiB
46Részben helyes4ms564 KiB
47Részben helyes1ms316 KiB
48Részben helyes1ms316 KiB
49Részben helyes6ms820 KiB
50Részben helyes6ms820 KiB
51Részben helyes1ms316 KiB
52Elfogadva1ms360 KiB
53Részben helyes1ms316 KiB
54Elfogadva1ms316 KiB
55Elfogadva1ms316 KiB
56Részben helyes1ms316 KiB
57Hibás válasz1ms508 KiB
58Részben helyes1ms408 KiB
59Elfogadva1ms316 KiB
60Elfogadva1ms316 KiB
61Részben helyes1ms384 KiB
62Hibás válasz1ms316 KiB
63Hibás válasz2ms316 KiB
64Hibás válasz2ms316 KiB
65Hibás válasz3ms564 KiB
66Hibás válasz4ms788 KiB