Submission #2167940
Source Code Expand
#include <bits/stdc++.h>
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))
using namespace std;
template<class T>bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0;}
template<class T>bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0;}
using ll = long long;
using R = long double;
const R EPS = 1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);}
inline R sq(R x) {return sqrt(max(x, 0.0L));}
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
// Problem Specific Parameter:
ll C[1010][1010];
const ll inf = 1LL << 60;
ll Add(ll a, ll b) {
return min(a + b, inf);
}
int main(void) {
const int limit = 1000;
rep(i, limit + 1) {
rep(j, i + 1) {
if (j == 0 or j == i)
C[i][j] = 1LL;
else
C[i][j] = Add(C[i - 1][j - 1], C[i - 1][j]);
}
}
ll n;
cin >> n;
ll total = 0LL;
int cmax = 0;
while (total + C[7 + cmax][7] <= n) {
total += C[7 + cmax][7];
cmax++;
//cerr << cmax << " " << C[7 + cmax][7] << endl;
}
n -= total;
vector<int> coef(cmax, 1);
rrep(i, cmax) {
while (n >= C[7 + i][7]) {
n -= C[7 + i][7];
coef[i]++;
}
}
rrep(i, cmax) {
rep(loop, coef[i]) cout << "F";
cout << "ESTIVAL";
}
cout << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
G - FESTIVAL |
User |
Hec |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1997 Byte |
Status |
WA |
Exec Time |
4 ms |
Memory |
7424 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 1000 |
Status |
|
|
Set Name |
Test Cases |
Sample |
example0.txt, example1.txt |
All |
000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, 039.txt, 040.txt, 041.txt, 042.txt, 043.txt, 044.txt, 045.txt, 046.txt, 047.txt, 048.txt, 049.txt, 050.txt, 051.txt, 052.txt, 053.txt, example0.txt, example1.txt |
Case Name |
Status |
Exec Time |
Memory |
000.txt |
AC |
4 ms |
7424 KB |
001.txt |
AC |
4 ms |
7424 KB |
002.txt |
AC |
4 ms |
7424 KB |
003.txt |
AC |
4 ms |
7424 KB |
004.txt |
AC |
4 ms |
7424 KB |
005.txt |
AC |
4 ms |
7424 KB |
006.txt |
AC |
4 ms |
7424 KB |
007.txt |
AC |
4 ms |
7424 KB |
008.txt |
AC |
4 ms |
7424 KB |
009.txt |
AC |
4 ms |
7424 KB |
010.txt |
AC |
4 ms |
7424 KB |
011.txt |
AC |
4 ms |
7424 KB |
012.txt |
AC |
4 ms |
7424 KB |
013.txt |
AC |
4 ms |
7424 KB |
014.txt |
AC |
4 ms |
7424 KB |
015.txt |
AC |
4 ms |
7424 KB |
016.txt |
AC |
4 ms |
7424 KB |
017.txt |
WA |
4 ms |
7424 KB |
018.txt |
WA |
4 ms |
7424 KB |
019.txt |
WA |
4 ms |
7424 KB |
020.txt |
WA |
4 ms |
7424 KB |
021.txt |
WA |
4 ms |
7424 KB |
022.txt |
WA |
4 ms |
7424 KB |
023.txt |
WA |
4 ms |
7424 KB |
024.txt |
WA |
4 ms |
7424 KB |
025.txt |
WA |
4 ms |
7424 KB |
026.txt |
WA |
4 ms |
7424 KB |
027.txt |
WA |
4 ms |
7424 KB |
028.txt |
WA |
4 ms |
7424 KB |
029.txt |
WA |
4 ms |
7424 KB |
030.txt |
WA |
4 ms |
7424 KB |
031.txt |
WA |
4 ms |
7424 KB |
032.txt |
WA |
4 ms |
7424 KB |
033.txt |
WA |
4 ms |
7424 KB |
034.txt |
AC |
4 ms |
7424 KB |
035.txt |
AC |
4 ms |
7424 KB |
036.txt |
AC |
4 ms |
7424 KB |
037.txt |
AC |
4 ms |
7424 KB |
038.txt |
WA |
4 ms |
7424 KB |
039.txt |
WA |
4 ms |
7424 KB |
040.txt |
WA |
4 ms |
7424 KB |
041.txt |
WA |
4 ms |
7424 KB |
042.txt |
WA |
4 ms |
7424 KB |
043.txt |
WA |
4 ms |
7424 KB |
044.txt |
WA |
4 ms |
7424 KB |
045.txt |
WA |
4 ms |
7424 KB |
046.txt |
WA |
4 ms |
7424 KB |
047.txt |
WA |
4 ms |
7424 KB |
048.txt |
WA |
4 ms |
7424 KB |
049.txt |
WA |
4 ms |
7424 KB |
050.txt |
AC |
4 ms |
7424 KB |
051.txt |
WA |
4 ms |
7424 KB |
052.txt |
AC |
4 ms |
7424 KB |
053.txt |
AC |
4 ms |
7424 KB |
example0.txt |
AC |
4 ms |
7424 KB |
example1.txt |
AC |
4 ms |
7424 KB |