QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#508719#7660. Investigating Frog Behaviour on Lily Pad PatternsziripoWA 0ms4072kbC++20535b2024-08-07 19:33:232024-08-07 19:33:24

Judging History

This is the latest submission verdict.

  • [2024-08-07 19:33:24]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 4072kb
  • [2024-08-07 19:33:23]
  • Submitted

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
	int n, c; cin >> n;
	vector<int> a;
	set<int> b;
	scanf("%lld", &c); a.push_back(c);
	for (int i = 1; i < n; i++) {
		scanf("%lld", &c), a.push_back(c);
		for (int j = a[i - 1] + 1; j < c; j++) b.insert(j);
	}
	for (int j = a[n - 1] + 1; j < a[n - 1] + n; j++) b.insert(j);
	int q; cin >> q;
	for (int i = 0; i < q; i++) {
		scanf("%lld", &c);
		a[c] = *b.equal_range(a[c]).first;
		b.erase(a[c]);
		printf("%lld\n", a[c]);
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3852kb

input:

5
1 2 3 5 7
3
1
2
4

output:

4
6
8

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

5
1 2 3 5 7
4
1
1
1
1

output:

4
6
8
9

result:

ok 4 lines

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 4072kb

input:

5
1 2 3 4 5
20
1
4
4
3
5
3
3
5
2
2
5
4
1
4
2
3
1
5
3
3

output:

6
7
8
9
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

wrong answer 4th lines differ - expected: '4', found: '9'