QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#59848#3017. Missing GnomesYaoBIG#WA 2ms3688kbC++17752b2022-11-01 19:23:082022-11-01 19:23:11

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-01 19:23:11]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3688kb
  • [2022-11-01 19:23:08]
  • 提交

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;
}

详细

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