162732025-04-20 09:16:44horkaÖsszegzésekcpp17Hibás válasz 24/1006ms820 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};
    if(*max_element(all(v))==1) el=p;
    else
    {
        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(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
1Elfogadva1ms316 KiB
2Elfogadva1ms316 KiB
3Hibás válasz2ms316 KiB
subtask26/6
4Elfogadva1ms500 KiB
5Elfogadva1ms316 KiB
6Elfogadva1ms316 KiB
7Elfogadva1ms508 KiB
8Elfogadva1ms316 KiB
subtask33/6
9Részben helyes1ms316 KiB
10Részben helyes1ms316 KiB
11Részben helyes1ms400 KiB
12Részben helyes4ms564 KiB
13Részben helyes4ms592 KiB
subtask45/10
14Részben helyes1ms316 KiB
15Részben helyes1ms316 KiB
16Részben helyes1ms400 KiB
17Részben helyes4ms564 KiB
18Részben helyes4ms592 KiB
19Részben helyes1ms316 KiB
20Részben helyes1ms412 KiB
21Részben helyes6ms820 KiB
22Részben helyes6ms756 KiB
23Részben helyes6ms820 KiB
subtask55/10
24Részben helyes1ms316 KiB
25Részben helyes1ms316 KiB
26Részben helyes1ms316 KiB
27Részben helyes1ms508 KiB
28Részben helyes1ms316 KiB
subtask65/10
29Elfogadva1ms316 KiB
30Részben helyes1ms316 KiB
31Elfogadva1ms316 KiB
32Elfogadva1ms400 KiB
33Részben helyes1ms316 KiB
subtask70/58
34Elfogadva1ms316 KiB
35Elfogadva1ms316 KiB
36Hibás válasz2ms316 KiB
37Elfogadva1ms500 KiB
38Elfogadva1ms316 KiB
39Elfogadva1ms316 KiB
40Elfogadva1ms508 KiB
41Elfogadva1ms316 KiB
42Részben helyes1ms316 KiB
43Részben helyes1ms316 KiB
44Részben helyes1ms400 KiB
45Részben helyes4ms564 KiB
46Részben helyes4ms592 KiB
47Részben helyes1ms316 KiB
48Részben helyes1ms412 KiB
49Részben helyes6ms820 KiB
50Részben helyes6ms756 KiB
51Részben helyes1ms316 KiB
52Elfogadva1ms316 KiB
53Részben helyes1ms316 KiB
54Elfogadva1ms316 KiB
55Elfogadva1ms400 KiB
56Részben helyes1ms316 KiB
57Hibás válasz1ms328 KiB
58Részben helyes1ms500 KiB
59Elfogadva1ms316 KiB
60Elfogadva1ms500 KiB
61Részben helyes1ms500 KiB
62Hibás válasz1ms316 KiB
63Hibás válasz2ms316 KiB
64Hibás válasz2ms500 KiB
65Hibás válasz3ms628 KiB
66Hibás válasz4ms820 KiB