Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
112203 | 梁颢城 | 求最长不下降序列 | C++ | 解答错误 | 0 | 0 MS | 256 KB | 610 | 2023-11-25 10:56:54 |
using namespace std; int main(){ int b[201][10]; int n=1; while(~scanf("%d",&b[++n][1])){ b[n][2] = 1; b[n][3] = 0; } int l,k; for(int i = n-1;i >= 1;i--){ l = 0; k = 0; for(int j = i+1;j <= n;j++){ if(b[j][1] >= b[i][1] && b[i][2] > l) { l = b[j][2]; k = j; } if(l > 0){ b[i][2] = l+1; b[i][3] = k; } } } k = 1; for(int j = 1;j <= n;j++){ if(b[j][2] >b[k][2]){ k = j; } } cout << "max=" << b[k][2] << endl; while(k!=0){ cout<< b[k][1] << ' ' ; k = b[k][3]; } return 0; }
300 250 275 252 200 138 245
max=2
250 252
max=2
250 275
exit code: 0, checker exit code: 0
14985 12531 10887 19172 19853 17363 16825 23471 11869 7515 17591 21140 7372 18733 11723 19036 8131 5351 16296 2052 10350 28607 13742 5394 9238 3387 6484 8627 6641 9689 29592 23222 21499 4385 4463 103...
max=2
14985 15924
max=17
5351 5394 6484 8627 9689 10362 12583 14516 14996 15952 16187 16600 20139 25207 27300 28111 28406
exit code: 0, checker exit code: 0
554 345 75 178 51 64 28 18 51 51 542 17
max=2
345 542
max=3
75 178 542
exit code: 0, checker exit code: 0
1989 1220 616 1619 1606 1981 118 123 456 789
max=2
1220 1981
max=4
118 123 456 789
exit code: 0, checker exit code: 0
123 256 369 213 456 956 23 698 1236 321 500 666
max=2
123 666
max=6
123 256 369 456 956 1236
exit code: 0, checker exit code: 0
9 8 7 9 8 7 9 8 7 55 66 99 88 77 88 963 365 4561
max=2
9 4561
max=9
7 8 9 55 66 77 88 963 4561
exit code: 0, checker exit code: 0
399 400 700 200 100 600 800 900 299 400 276
max=2
399 400
max=5
399 400 700 800 900
exit code: 0, checker exit code: 0
181 205 471 782 1033 1058 1111
max=2
181 1111
max=7
181 205 471 782 1033 1058 1111
exit code: 0, checker exit code: 0
300 150 120 540 360 471 140 364 146 340
max=2
300 340
max=4
120 140 146 340
exit code: 0, checker exit code: 0
465 978 486 476 324 575 384 278 214 657 218 445 123
max=2
465 657
max=4
465 486 575 657
exit code: 0, checker exit code: 0