QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#670759 | #3017. Missing Gnomes | 0point1_zishan | TL | 11ms | 5492kb | C++20 | 1.1kb | 2024-10-24 00:29:47 | 2024-10-24 00:29:47 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
void solve(){
int n, k; cin >> n >> k;
vector<int> v(k), mi;
vector<bool>isPre(n+1, false);
for(int i = 0; i < k; i++){
cin >> v[i];
isPre[v[i]] = true;
}
for(int i = 1; i <= n; i++){
if(!isPre[i]) mi.push_back(i);
}
isPre.clear();
int j = 0;
vector<int> ans;
int mx = INT_MIN;
for(int i = 0; i < k; i++){
for(int l = j; l < mi.size(); l++){
if(v[i] < mi[l]){
j = l;
break;
}
ans.push_back(mi[l]), mx = max(mx, mi[l]);
}
ans.push_back(v[i]);
mx = max(mx, v[i]);
}
for(int i = mx + 1; i <= n; i++){
ans.push_back(i);
}
for(int i = 0; i < ans.size(); i++) cout << ans[i] << "\n";
}
signed main(){
fast;
int t = 1;
//cin >> t;
while(t--){solve();}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3744kb
input:
5 3 1 4 2
output:
1 3 4 2 5
result:
ok 5 number(s): "1 3 4 2 5"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
7 4 6 4 2 1
output:
3 5 6 4 2 1 7
result:
ok 7 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
1 1 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 6ms
memory: 5420kb
input:
100000 1 1
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...
result:
ok 100000 numbers
Test #5:
score: 0
Accepted
time: 6ms
memory: 5448kb
input:
100000 1 50000
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...
result:
ok 100000 numbers
Test #6:
score: 0
Accepted
time: 6ms
memory: 5492kb
input:
100000 1 100000
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...
result:
ok 100000 numbers
Test #7:
score: 0
Accepted
time: 6ms
memory: 5468kb
input:
100000 2 1 100000
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...
result:
ok 100000 numbers
Test #8:
score: 0
Accepted
time: 3ms
memory: 5440kb
input:
100000 2 100000 1
output:
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 10...
result:
ok 100000 numbers
Test #9:
score: 0
Accepted
time: 10ms
memory: 5064kb
input:
100000 100000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...
result:
ok 100000 numbers
Test #10:
score: 0
Accepted
time: 10ms
memory: 4988kb
input:
100000 100000 100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 999...
output:
100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 99952 99951...
result:
ok 100000 numbers
Test #11:
score: 0
Accepted
time: 11ms
memory: 4984kb
input:
100000 100000 39879 80207 30463 2318 55225 20215 5379 46430 50660 68653 99954 20676 41233 17876 81864 47319 71862 96309 88699 19724 97292 53480 83946 56863 22922 95756 9532 38001 17586 55007 17587 24126 19204 11475 96487 28127 24779 11610 77529 38611 32881 80648 59960 75749 27034 8906 19636 34253 82...
output:
39879 80207 30463 2318 55225 20215 5379 46430 50660 68653 99954 20676 41233 17876 81864 47319 71862 96309 88699 19724 97292 53480 83946 56863 22922 95756 9532 38001 17586 55007 17587 24126 19204 11475 96487 28127 24779 11610 77529 38611 32881 80648 59960 75749 27034 8906 19636 34253 8243 33576 53070...
result:
ok 100000 numbers
Test #12:
score: 0
Accepted
time: 4ms
memory: 5124kb
input:
100000 50000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99...
output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...
result:
ok 100000 numbers
Test #13:
score: -100
Time Limit Exceeded
input:
100000 50000 100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 9995...