Submission #991923
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII; typedef pair<LL, LL> PLL;
typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<VVI> VVVI;
typedef vector<LL> VLL; typedef vector<VLL> VVLL; typedef vector<VVLL> VVVLL;
typedef vector<double> VD; typedef vector<VD> VVD; typedef vector<VVD> VVVD;
typedef vector<string> VS; typedef vector<VS> VVS; typedef vector<VVS> VVVS;
typedef vector<bool> VB; typedef vector<VB> VVB; typedef vector<VVB> VVVB;
typedef vector<PII> VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL> VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;
typedef unsigned int UI;
typedef vector<UI> VUI;
typedef vector<VUI> VVUI;
#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N) for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N) for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP(x) cerr << #x << " = " << (x) << endl
template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a) { OSS oss; oss << a; return oss.str(); };
template<typename T=int> inline void dump(vector<T> vs, bool ent=false) { rep(i, vs.size()) cout << vs[i] << (i+1==vs.size() ? '\n' : ' '); if (ent) cout << endl; }
template<typename T = int> inline void dump(vector<vector<T>> vs, bool ent=false) { rep(i, vs.size()) dump<T>(vs[i]); if (ent) cout << endl; }
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int DX[] = {1, 0, -1, 0};
const int DY[] = {0, -1, 0, 1};
const double EPS = 1e-12;
// const double PI = acos(-1.0);
template<typename T = int> inline T in() { T x; cin >> x; return x; }
template<typename T = int> inline vector<T> in(int n) { vector<T> xs(n); rep(i, n) cin >> xs[i]; return xs; }
template<typename T = int> inline vector<vector<T>> in(int n, int m) { vector<vector<T>> xs(n, vector<T>(m)); rep(i, n) rep(j, m) cin >> xs[i][j]; return xs; }
int main(void) {
int n = in();
int sum = 0;
int m = 0;
while (sum < n) {
++m;
sum += m;
}
while (sum > n) {
if (sum - m >= n) {
sum -= m;
} else {
cout << m << endl;
}
--m;
}
while (m) {
cout << m << endl;
--m;
}
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Exactly N points |
User |
snakazawa |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
3158 Byte |
Status |
AC |
Exec Time |
17 ms |
Memory |
256 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 |
2 ms |
256 KB |
01-02.txt |
AC |
2 ms |
256 KB |
01-03.txt |
AC |
2 ms |
256 KB |
01-04.txt |
AC |
2 ms |
256 KB |
01-05.txt |
AC |
2 ms |
256 KB |
01-06.txt |
AC |
2 ms |
256 KB |
01-07.txt |
AC |
2 ms |
256 KB |
01-08.txt |
AC |
2 ms |
256 KB |
01-09.txt |
AC |
2 ms |
256 KB |
01-10.txt |
AC |
2 ms |
256 KB |
02-01.txt |
AC |
17 ms |
256 KB |
02-02.txt |
AC |
17 ms |
256 KB |
02-03.txt |
AC |
17 ms |
256 KB |
02-04.txt |
AC |
17 ms |
256 KB |
02-05.txt |
AC |
17 ms |
256 KB |
02-06.txt |
AC |
10 ms |
256 KB |
02-07.txt |
AC |
8 ms |
256 KB |
02-08.txt |
AC |
17 ms |
256 KB |
sample-01.txt |
AC |
2 ms |
256 KB |
sample-02.txt |
AC |
2 ms |
256 KB |
sample-03.txt |
AC |
2 ms |
256 KB |