Submission #1152161
Source Code Expand
#include <bits/stdc++.h> using namespace std; const int N = 4500; int n, len; int g[N], f[N][N], pre[N][N]; int vis[N]; void init() { g[0] = 0; for (int i = 1;; i++) { if (g[i - 1] + i > (int)1e7) { len = i - 1; break; } g[i] = g[i - 1] + i; } } int main() { init(); cin >> n; int v = lower_bound(g + 1, g + 1 + len, n) - g; int val = g[v] - n; f[0][0] = 1; for (int i = 1; i <= n; i++) { for (int j = 0; j <= val; j++) { if (j - i >= 0 && f[i - 1][j - i] == 1) f[i][j] = 1, pre[i][j] = j - i; if (f[i - 1][j] == 1) f[i][j] = 1, pre[i][j] = j; } } int pt = n; while(pt >= 1) { int key = pre[pt][val]; vis[val - key] = 1; pt--, val = key; } for(int i = 1; i <= v; i++) { if(vis[i]) continue; printf("%d\n", i); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Exactly N points |
User | kakapo2000 |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 872 Byte |
Status | RE |
Exec Time | 146 ms |
Memory | 157568 KB |
Judge Result
Set Name | sample | dataset1 | dataset2 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 0 / 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, sample-01.txt, sample-02.txt, sample-03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 2 ms | 2304 KB |
01-02.txt | AC | 2 ms | 2304 KB |
01-03.txt | AC | 2 ms | 2304 KB |
01-04.txt | AC | 2 ms | 4608 KB |
01-05.txt | AC | 3 ms | 6912 KB |
01-06.txt | AC | 5 ms | 21248 KB |
01-07.txt | AC | 9 ms | 37632 KB |
01-08.txt | AC | 9 ms | 37632 KB |
01-09.txt | AC | 9 ms | 37632 KB |
01-10.txt | AC | 9 ms | 37632 KB |
02-01.txt | RE | 127 ms | 156544 KB |
02-02.txt | RE | 126 ms | 156544 KB |
02-03.txt | RE | 103 ms | 2304 KB |
02-04.txt | RE | 104 ms | 2304 KB |
02-05.txt | RE | 104 ms | 2304 KB |
02-06.txt | RE | 134 ms | 156928 KB |
02-07.txt | RE | 135 ms | 156928 KB |
02-08.txt | RE | 146 ms | 157568 KB |
sample-01.txt | AC | 2 ms | 2304 KB |
sample-02.txt | AC | 2 ms | 2304 KB |
sample-03.txt | AC | 2 ms | 2304 KB |