QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#728392#9573. Social Mediaucup-team4801#WA 23ms5864kbC++14883b2024-11-09 15:05:062024-11-09 15:05:07

Judging History

你现在查看的是最新测评结果

  • [2024-11-09 15:05:07]
  • 评测
  • 测评结果:WA
  • 用时:23ms
  • 内存:5864kb
  • [2024-11-09 15:05:06]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=200010;
int n,m,k;bool vs[N];
int u[N],v[N];int du[N],p[N];
void solve(){
    scanf("%d%d%d",&n,&m,&k);
    for(int i=1;i<=k;i++)vs[i]=du[i]=0,p[i]=i;
    for(int i=1;i<=n;i++){
        int x;scanf("%d",&x);vs[x]=1;
    }
    for(int i=1;i<=m;i++){
        scanf("%d%d",u+i,v+i);
        if(vs[u[i]]&&!vs[v[i]])du[v[i]]++;
        if(vs[v[i]]&&!vs[u[i]])du[u[i]]++;
    }
    sort(p+1,p+k+1,[](int x,int y){return du[x]>du[y];});
    int ans=0;
    for(int i=1;i<=10;i++)if(!vs[p[i]])for(int j=i+1;j<=10;j++)if(!vs[p[j]]){
        vs[p[i]]=vs[p[j]]=1;int c=0;
        for(int k=1;k<=m;k++)c+=vs[v[k]]&&vs[u[k]];
        vs[p[i]]=vs[p[j]]=0;ans=max(ans,c);
    }
    printf("%d\n",ans);
}
int main(){
    // freopen("in","r",stdin);
    int T;scanf("%d",&T);
    while(T--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5864kb

input:

5
4 12 7
5 7 3 6
3 6
2 2
1 4
2 4
1 3
7 6
4 1
5 4
1 1
1 1
2 1
3 7
2 7 6
2 4
1 2
3 2
2 5
5 4
2 6
4 6
2 6
1 1 2
1
1 2
2 1 2
1 2
1 2
2 1 100
24 11
11 24

output:

9
5
1
1
1

result:

ok 5 number(s): "9 5 1 1 1"

Test #2:

score: -100
Wrong Answer
time: 23ms
memory: 3780kb

input:

10000
19 12 20
8 12 1 5 11 7 17 13 19 6 3 9 10 15 14 20 4 18 16
4 11
7 1
8 4
16 19
1 13
15 2
16 2
8 7
3 15
11 13
5 20
18 14
17 14 20
2 9 1 12 8 11 10 17 18 16 3 15 5 14 20 13 7
15 10
3 2
5 16
7 8
6 1
6 4
18 16
1 8
4 1
20 6
6 9
4 15
7 5
14 9
1 3 18
9
15 18
17 15
11 14
7 19 7
3 1 2 5 6 4 7
5 1
4 5
3 1...

output:

0
14
1
19
6
5
1
11
0
0
3
10
4
1
0
19
0
2
18
4
0
5
0
2
5
17
3
0
6
15
0
2
6
4
4
7
0
0
4
0
16
0
1
3
6
12
12
0
6
0
8
6
0
0
0
0
4
0
0
0
2
0
0
19
0
7
0
0
8
0
7
9
0
0
2
17
0
5
5
0
6
6
0
0
13
0
10
0
3
6
3
1
0
5
8
0
0
0
10
0
9
11
0
9
0
2
8
0
0
5
3
5
5
10
1
6
9
0
0
3
19
1
4
8
8
0
4
2
1
15
0
9
2
3
17
14
1
4
8
...

result:

wrong answer 1st numbers differ - expected: '12', found: '0'