QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#130989 | #5378. 匹配问题 | Sorting | 0 | 2ms | 5532kb | C++ | 598b | 2023-07-26 02:01:34 | 2023-07-26 02:01:36 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n;
int la,lb;
int a[500001],b[500001];
int main(){
ios::sync_with_stdio(false);cin.tie(0);
cin >> n >> la >> lb;
for(int i=1; i<=n ;i++) cin >> a[i];
for(int i=1; i<=n ;i++) cin >> b[i];
sort(a+1,a+n+1);
sort(b+1,b+n+1);
int ans=0;
for(int i=n; i>=1 ;i--){
int x=i;
while(x>=1 && b[x]>a[i]+lb) x--;
if(x>=1 && b[x]>a[i]){
bool ok=true;
for(int j=x; j<i ;j++){
if(b[j+1]>a[j]+la) ok=false;
}
if(ok){
ans++;
for(int j=x; j<i ;j++) swap(b[j],b[j+1]);
}
}
}
cout << ans << '\n';
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 5532kb
input:
2 2 1 1 1 1 1
output:
0
result:
wrong answer 1st lines differ - expected: '2', found: '0'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Time Limit Exceeded
Test #100:
score: 0
Time Limit Exceeded
input:
500000 500000 10 200184 74991 71203 334998 316800 34483 120570 301054 331108 232072 189788 397143 490296 56807 361700 88818 42376 460305 371750 450351 338384 429789 426045 445029 152316 408919 188124 144966 457495 475025 225370 260510 383159 495247 54319 246245 240728 372033 439599 119720 449020 451...
output:
result:
Subtask #5:
score: 0
Skipped
Dependency #1:
0%