QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#59848 | #3017. Missing Gnomes | YaoBIG# | WA | 2ms | 3688kb | C++17 | 752b | 2022-11-01 19:23:08 | 2022-11-01 19:23:11 |
Judging History
answer
#include "bits/stdc++.h"
#define rep(i, a, n) for (auto i = a; i <= (n); ++i)
#define revrep(i, a, n) for (auto i = n; i >= (a); --i)
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a).size()
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int n, m; cin >> n >> m;
vi as(m);
vi mark(n);
for (auto &x: as) {
cin >> x;
x--;
mark[x] = 1;
}
vi bs;
rep(i, 0, n - 1) if (mark[i] == 0) {
bs.push_back(i);
}
auto it = as.begin();
vi ans;
for (auto x: bs) {
while (it != as.end() && *it < x) {
ans.push_back(*it);
it++;
}
ans.push_back(x);
}
for (auto x: ans) printf("%d\n", x + 1);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3684kb
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: 2ms
memory: 3688kb
input:
7 4 6 4 2 1
output:
3 5 6 4 2 1 7
result:
ok 7 numbers
Test #3:
score: -100
Wrong Answer
time: 2ms
memory: 3388kb
input:
1 1 1
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements