Submission #7459288


Source Code Expand

Copy
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define V vector<int>
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 50;

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

P ps[100100];

int n, m;
int a[100100], b[100100];

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	int tmp = 0;
	int id = 0;
	for (int i = 1; i <= n; i++) {
		tmp += i;
		if (tmp >= n) {
			id = i; break;
		}
	}
	if (tmp == n) {
		for (int i = 1; i <= id; i++) {
			cout << i << endl;
		}
	}
	else {
		int tmp2 = 0;
		for (int i = 1; i <= id; i++) {
			if (tmp - i == n) {
				tmp2 = i; break;
			}
		}
		for (int i = 1; i <= id; i++) {
			if (i != tmp2)cout << i << endl;
		}
	}
	return 0;
}

Submission Info

Submission Time
Task B - Exactly N points
User Example
Language C++14 (GCC 5.4.1)
Score 300
Code Size 2139 Byte
Status
Exec Time 8 ms
Memory 256 KB

Judge Result

Set Name Score / Max Score Test Cases
sample 0 / 0 sample-01.txt, sample-02.txt, sample-03.txt
dataset1 200 / 200 sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt
dataset2 100 / 100 sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt 1 ms 256 KB
01-02.txt 1 ms 256 KB
01-03.txt 1 ms 256 KB
01-04.txt 1 ms 256 KB
01-05.txt 1 ms 256 KB
01-06.txt 1 ms 256 KB
01-07.txt 1 ms 256 KB
01-08.txt 1 ms 256 KB
01-09.txt 1 ms 256 KB
01-10.txt 1 ms 256 KB
02-01.txt 8 ms 256 KB
02-02.txt 8 ms 256 KB
02-03.txt 8 ms 256 KB
02-04.txt 8 ms 256 KB
02-05.txt 8 ms 256 KB
02-06.txt 5 ms 256 KB
02-07.txt 4 ms 256 KB
02-08.txt 8 ms 256 KB
sample-01.txt 1 ms 256 KB
sample-02.txt 1 ms 256 KB
sample-03.txt 1 ms 256 KB