QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#21317#2823. 改善生活gsh#WA 1ms1788kbC++14941b2022-03-04 15:15:592022-05-08 02:52:30

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-08 02:52:30]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:1788kb
  • [2022-03-04 15:15:59]
  • 提交

answer

//什么时候我才能有杜爷一半强啊/kk
#include<cstdio>
#include<bitset>
#define int long long
using namespace std;
const int N=705;
int n,m,ans,sum[N],c[N],w[N];
bitset<N>bs[N];
int Max(int a,int b){return a>b?a:b;}
int Min(int a,int b){return a<b?a:b;}
int read(){
	char ch=getchar();int nn=0,ssss=1;
	while(ch<'0'||ch>'9'){if(ch=='-')ssss*=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){nn=nn*10+(ch-'0');ch=getchar();}
	return nn*ssss;
}
signed main(){
	n=read();m=read();
	for(int i=1;i<=n;i++)c[i]=read();
	for(int i=1;i<=n;i++)w[i]=read();
	for(int i=1;i<=m;i++){
		int u=read();int v=read();
		bs[u][v]=true;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(bs[i][j])bs[i]|=bs[j];
	for(int i=1;i<=n;i++){
		if(c[i]!=1)continue;
		for(int j=1;j<=n;j++)sum[j]=0;
		for(int j=1;j<=n;j++)if(bs[i][j])sum[c[j]]+=w[j];
		for(int i=2;i<=n;i++)ans=Max(ans,sum[i]/w[i]);
	}
	printf("%lld",ans);
}

详细

Test #1:

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

input:

7 8
2 2 1 1 3 3 4
100 100 40 20 100 50 40
1 3
2 3
1 4
2 4
3 5
4 6
3 7
4 7

output:

2

result:

ok single line: '2'

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 1772kb

input:

15 36
1 1 1 1 1 1 1 3 3 4 5 5 6 4 2
1 5 4 16 1 16 9 98 84 69 4 95 53 99 64
1 8
2 8
3 8
4 8
5 8
6 8
7 8
8 9
8 11
9 8
9 10
9 11
9 12
9 14
10 8
10 11
10 12
11 8
11 9
11 10
11 12
11 14
12 13
12 14
13 8
13 9
13 10
13 12
13 14
13 15
14 10
14 13
14 15
15 9
15 11
15 13

output:

99

result:

wrong answer 1st lines differ - expected: '182', found: '99'