QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#508690#7660. Investigating Frog Behaviour on Lily Pad PatternsAbclWA 17ms8276kbC++14684b2024-08-07 19:16:422024-08-07 19:16:43

Judging History

This is the latest submission verdict.

  • [2024-08-07 19:16:43]
  • Judged
  • Verdict: WA
  • Time: 17ms
  • Memory: 8276kb
  • [2024-08-07 19:16:42]
  • Submitted

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=200005;
int n;
int a[N];
set<int> nums;
void solve(){
	cin>>n;cin>>a[1];
	for(int i=2;i<=n;i++){
		cin>>a[i];
		for(int j=a[i-1]+1;j<a[i];j++) nums.insert(j);
	}
	for(int i=a[n]+1;i<=100001;i++)nums.insert(i);
	int q;cin>>q;
	while(q--){
		int x;cin>>x;
		auto it=nums.upper_bound(a[x]);
		cout<<*it<<endl;
		a[x]=*it;
		nums.erase(it);
	}
	
	return;
}
signed main() {
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int T_case=1;
	//cin>>T_case;
	while(T_case--){
		solve();
	}
    return 0;
}


详细

Test #1:

score: 100
Accepted
time: 17ms
memory: 8268kb

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: 13ms
memory: 8276kb

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: 13ms
memory: 8268kb

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
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

result:

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