QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#362991 | #7660. Investigating Frog Behaviour on Lily Pad Patterns | Captainfly | TL | 752ms | 64824kb | C++20 | 1.3kb | 2024-03-23 17:48:40 | 2024-03-23 17:48:43 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define maxn 1000010
// #define int long long
int x[maxn];
// map<int,int> pos ;
set<int> s;
signed main()
{
// ios::sync_with_stdio(false);
// cin.tie(0);
// cout.tie(0);
int n;
scanf("%d",&n);
// vector<int> vec;
for(int i=1;i<=(1e6)+(3e5);i++)
{
s.insert(i);
}
for(int i=1;i<=n;i++)
{
scanf("%d",&x[i]);
s.erase(x[i]);
}
int q;
scanf("%d",&q);
while(q--)
{
int p;
scanf("%d",&p);
auto k=lower_bound(s.begin(),s.end(),x[p]);
int ff=*k;
s.erase(k);
s.insert(x[p]);
x[p]=ff;
printf("%d\n",ff);
}
return 0;
}
// #include<bits/stdc++.h>
// using namespace std;
// #define MAXN 1000005
// int n, pos[MAXN], q, x;
// set<int> s;
// int main(){
// cin>>n;
// for(int i=1;i<=(1e6)+(3e5);i++) s.insert(i);
// for(int i=1;i<=n;i++) scanf("%d", &pos[i]), s.erase(pos[i]);
// cin>>q;
// for(int i=1;i<=q;i++){
// scanf("%d", &x);
// auto it = s.lower_bound(pos[x]);
// int tmp = *it;
// s.erase(it);
// s.insert(pos[x]);
// pos[x] = tmp;
// printf("%d\n", tmp);
// }
// return 0;
// }
詳細信息
Test #1:
score: 100
Accepted
time: 373ms
memory: 64672kb
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: 384ms
memory: 64716kb
input:
5 1 2 3 5 7 4 1 1 1 1
output:
4 6 8 9
result:
ok 4 lines
Test #3:
score: 0
Accepted
time: 752ms
memory: 64824kb
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 4 7 5 9 10 3 4 11 10 7 12 5 10 8 13 11 14
result:
ok 20 lines
Test #4:
score: -100
Time Limit Exceeded
input:
10 2 4 6 7 8 9 10 12 13 14 1000 4 5 4 6 2 5 2 9 6 10 6 2 1 3 7 3 9 5 2 10 8 7 6 7 4 7 9 4 4 4 5 2 6 1 10 9 10 3 7 10 5 9 5 8 4 8 10 9 1 7 10 8 10 6 7 7 10 8 1 2 9 10 2 3 8 7 2 7 2 2 1 10 3 3 2 8 9 6 10 1 7 9 10 6 5 9 9 6 4 9 10 3 3 10 5 4 8 5 8 4 9 5 5 3 9 7 5 5 4 6 1 8 6 7 9 2 2 4 9 3 6 4 6 8 4 4 3...