-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPBATTLE.c
More file actions
44 lines (44 loc) · 979 Bytes
/
Copy pathPBATTLE.c
File metadata and controls
44 lines (44 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<stdio.h>
int main(){
int t,n;
scanf("%d",&t);
for(int i=0;i<t;i++){
scanf("%d",&n);
int a[n],b[n],c[n];
int max=0;
for(int j=0;j<n;j++){
scanf("%d",&a[j]);
}
for(int j=0;j<n;j++){
scanf("%d",&b[j]);
}
for(int j=0;j<n;j++){
int count=0;
for(int k=0;k<n;k++){
if(k==j){
continue;
}
if(a[j]>a[k]){
count++;
}
if(a[j]<a[k]){
if(b[j]>b[k]){
count++;
}
}
}
if(max<count){
max=count;
}
c[j]=count;
}
int count1=0;
for(int j=0;j<n;j++){
if(max==c[j]){
count1++;
}
}
printf("%d\n",count1);
}
return 0;
}