Submission #26850734
Source Code Expand
#include <stdio.h>
#include <algorithm>
#include <memory.h>
#include <vector>
#include <iostream>
#include <string>
#define int long long
int read(int x = 0, int f = 0, char ch = getchar())
{
while (ch < 48 or ch > 57)
f = ch == 45, ch = getchar();
while (48 <= ch and ch <= 57)
x = x * 10 + ch - 48, ch = getchar();
return f ? -x : x;
}
const int N = 1e6 + 5;
int n, k;
int a[N], buk[N];
signed main()
{
n = read(), k = read();
for (int i = 1; i <= k; i++)
a[i] = read();
for (int i = 1, j = 1; i < k; i++)
{
printf("%lld ", a[i]), buk[a[i]] = 1;
while (buk[j])
j++;
if (j < a[i])
printf("%lld ", j), buk[j] = 1;
}
for (int i = n; i >= 1; i--)
if (!buk[i])
printf("%lld ", i);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - LIS to Original Sequence |
| User | TosakaUCW |
| Language | C++ (GCC 9.2.1) |
| Score | 600 |
| Code Size | 866 Byte |
| Status | AC |
| Exec Time | 35 ms |
| Memory | 6820 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 600 / 600 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-001.txt, 00-sample-002.txt |
| All | 00-sample-001.txt, 00-sample-002.txt, 01-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt, 01-006.txt, 01-007.txt, 01-008.txt, 01-009.txt, 01-010.txt, 01-011.txt, 01-012.txt, 01-013.txt, 01-014.txt, 01-015.txt, 01-016.txt, 01-017.txt, 01-018.txt, 01-019.txt, 01-020.txt, 01-021.txt, 01-022.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-001.txt | AC | 8 ms | 3432 KiB |
| 00-sample-002.txt | AC | 2 ms | 3584 KiB |
| 01-001.txt | AC | 2 ms | 3432 KiB |
| 01-002.txt | AC | 2 ms | 3548 KiB |
| 01-003.txt | AC | 2 ms | 3608 KiB |
| 01-004.txt | AC | 23 ms | 4592 KiB |
| 01-005.txt | AC | 13 ms | 4184 KiB |
| 01-006.txt | AC | 21 ms | 5096 KiB |
| 01-007.txt | AC | 10 ms | 3896 KiB |
| 01-008.txt | AC | 17 ms | 4632 KiB |
| 01-009.txt | AC | 20 ms | 3428 KiB |
| 01-010.txt | AC | 27 ms | 3500 KiB |
| 01-011.txt | AC | 33 ms | 6820 KiB |
| 01-012.txt | AC | 35 ms | 6788 KiB |
| 01-013.txt | AC | 29 ms | 3528 KiB |
| 01-014.txt | AC | 21 ms | 3884 KiB |
| 01-015.txt | AC | 25 ms | 4968 KiB |
| 01-016.txt | AC | 30 ms | 5264 KiB |
| 01-017.txt | AC | 32 ms | 5868 KiB |
| 01-018.txt | AC | 25 ms | 5580 KiB |
| 01-019.txt | AC | 26 ms | 5284 KiB |
| 01-020.txt | AC | 30 ms | 5276 KiB |
| 01-021.txt | AC | 31 ms | 6196 KiB |
| 01-022.txt | AC | 33 ms | 6496 KiB |