Source Code
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <stdlib.h>
#include <time.h>
#include <stack>
#include <map>
#include <math.h>
#include <cmath>
#include <string.h>
#include <numeric>
using namespace std;
typedef vector<int> vi ;
typedef long long ll;
#define all(x) (x).begin() , (x).end()
#define allR(x) (x).rbegin() , (x).rend()
#define pb push_back
const int N = 1e6, M=1e6+1, NN=1e8 , MX = 1e9;
const ll MXL=1e18 , MOD = 1e9 + 7, MD= 998244353;
int a[N], deg[N]; 
int main(){
    // freopen("input.txt", "r", stdin);
    ll x, ans;
    scanf("%lld", &x);
    ll rem=x;
    vector<ll> v;
    for(ll i=1 ; rem >= i  ; i++ ){
        v.pb(i);
        rem-=i;
    }
    printf("%d\n", v.size());
    if( rem ) 
        v[v.size()-1] = rem;
    for(auto i: v)
        printf("%lld ", i);
    return 0 ;
}
Copy
Want More! Rand()
GNU G++17
89 ms
19.1 MB
Wrong Answer
Test Case #1
0 ms
360 KB
Accepted
Input
1
Output
1
1
Judge Output
1
1
Checker Message
the length and sum is correct.
Test Case #2
0 ms
520 KB
Accepted
Input
3
Output
2
1 2
Judge Output
2
1 2
Checker Message
the length and sum is correct.
Test Case #3
0 ms
592 KB
Accepted
Input
6
Output
3
1 2 3
Judge Output
3
1 2 3
Checker Message
the length and sum is correct.
Test Case #4
89 ms
19.1 MB
Wrong Answer
Input
758284843011
Output
1231490
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 ....
Judge Output
1231490
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 ...
Checker Message
the sum of the list printed by the participant is -1925599871 while the input is -1924368381.