Submission #992139
Source Code Expand
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i)) #define rep(i,n) FOR(i,0,n) #define pb push_back #define eb emplace_back #define mp make_pair #define fst first #define snd second #define all(v) begin(v), end(v) #define debug(x) cerr<< #x <<": "<<x<<endl #define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vector<int> > vvi; typedef vector<ll> vll; typedef vector<vector<ll> > vvll; typedef vector<char> vc; typedef vector<vector<char> > vvc; typedef vector<double> vd; typedef vector<vector<double> > vvd; template<class T> using vv=vector<vector< T > >; typedef deque<int> di; typedef deque<deque<int> > ddi; typedef deque<bool> db; typedef deque<deque<bool> > ddb; int main() { int n; cin >> n; int m = 10000; int mm = 0; vi tri(m, 0); rep (i, m) { tri[m] = i * (i+1) / 2; if (tri[m] >= n) { mm = i; break; } } set<int> si; int n_ = n; for (int i = mm; i >= 1; --i) { if (n_ >= i) { n_ -= i; si.insert(i); } if (n_ == 0) { break; } } for (auto i : si) { printf("%d\n", i); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Exactly N points |
User | tspcx |
Language | C++14 (Clang 3.8.0) |
Score | 300 |
Code Size | 1633 Byte |
Status | AC |
Exec Time | 6 ms |
Memory | 888 KB |
Judge Result
Set Name | sample | dataset1 | dataset2 | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 100 / 100 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt, sample-03.txt |
dataset1 | 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 | 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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 6 ms | 888 KB |
01-02.txt | AC | 3 ms | 256 KB |
01-03.txt | AC | 3 ms | 256 KB |
01-04.txt | AC | 3 ms | 256 KB |
01-05.txt | AC | 3 ms | 256 KB |
01-06.txt | AC | 3 ms | 256 KB |
01-07.txt | AC | 3 ms | 256 KB |
01-08.txt | AC | 3 ms | 256 KB |
01-09.txt | AC | 3 ms | 256 KB |
01-10.txt | AC | 3 ms | 256 KB |
02-01.txt | AC | 4 ms | 512 KB |
02-02.txt | AC | 4 ms | 512 KB |
02-03.txt | AC | 4 ms | 512 KB |
02-04.txt | AC | 4 ms | 512 KB |
02-05.txt | AC | 4 ms | 512 KB |
02-06.txt | AC | 3 ms | 384 KB |
02-07.txt | AC | 3 ms | 384 KB |
02-08.txt | AC | 4 ms | 512 KB |
sample-01.txt | AC | 3 ms | 256 KB |
sample-02.txt | AC | 3 ms | 256 KB |
sample-03.txt | AC | 3 ms | 256 KB |