Submission #1677524
Source Code Expand
#include <cstdio> using namespace std; typedef long long LL; const int N=210; const LL Inf=1e12+10; LL n,C[N][N]; int A[N],ans; LL Sum(int x) { LL sum=0; for (int i=2;i<=x;i+=2) sum+=C[x][i]; return sum; } void Prepare() { C[0][0]=1; for (int i=1;i<=200;++i) { C[i][0]=1; for (int j=1;j<=i;++j) { C[i][j]=C[i-1][j-1]+C[i-1][j]; if (C[i][j]>n) C[i][j]=Inf; } } } void Solve(LL n,int dep,int use) { if (!n) return ; int l=1,r=200-use; while (l<=r) { int mid=(l+r)>>1; if (Sum(mid)<=n) l=mid+1; else r=mid-1; } n-=Sum(r); A[dep]=r; ans+=r; Solve(n,dep+1,use+r); } int main() { scanf("%lld",&n); Prepare(); Solve(n,1,0); printf("%d\n",ans); for (int i=1;i<=200;++i) if (A[i]) for (int j=1;j<=A[i];++j) printf("%d ",i); else break; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Tautonym Puzzle |
User | Mcallor |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 849 Byte |
Status | RE |
Exec Time | 109 ms |
Memory | 512 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:50:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld",&n); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 1000 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt |
All | 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 1 ms | 512 KB |
00_example_02.txt | AC | 1 ms | 512 KB |
01.txt | RE | 109 ms | 512 KB |
02.txt | AC | 1 ms | 512 KB |
03.txt | AC | 1 ms | 512 KB |
04.txt | RE | 102 ms | 512 KB |
05.txt | AC | 1 ms | 512 KB |
06.txt | AC | 1 ms | 512 KB |
07.txt | RE | 102 ms | 512 KB |
08.txt | RE | 102 ms | 512 KB |
09.txt | AC | 1 ms | 512 KB |
10.txt | AC | 1 ms | 512 KB |
11.txt | AC | 1 ms | 512 KB |
12.txt | AC | 1 ms | 512 KB |
13.txt | RE | 101 ms | 512 KB |
14.txt | AC | 1 ms | 512 KB |
15.txt | AC | 1 ms | 512 KB |
16.txt | AC | 1 ms | 512 KB |
17.txt | AC | 1 ms | 512 KB |
18.txt | AC | 1 ms | 512 KB |
19.txt | RE | 102 ms | 512 KB |
20.txt | AC | 1 ms | 512 KB |
21.txt | RE | 105 ms | 512 KB |
22.txt | AC | 1 ms | 512 KB |
23.txt | RE | 103 ms | 512 KB |
24.txt | AC | 1 ms | 512 KB |
25.txt | AC | 1 ms | 512 KB |
26.txt | RE | 104 ms | 512 KB |
27.txt | RE | 101 ms | 512 KB |
28.txt | AC | 1 ms | 512 KB |
29.txt | RE | 101 ms | 512 KB |
30.txt | RE | 105 ms | 512 KB |