QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#50122#871. Interesting Scoring SystemsSparky327WA 1ms1724kbC++877b2022-09-24 16:56:022022-09-24 16:56:02

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-24 16:56:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:1724kb
  • [2022-09-24 16:56:02]
  • 提交

answer

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<map>
#include<cmath>
#define ll long long
using namespace std;
ll g[1000100],h[1000100]; 
ll win=0;
int main()
{
	int t;
	scanf("%d",&t);
	while (t--) {
		int n;
		win=0;
		scanf("%d",&n);
		for (int i=1;i<=n;i++){
			scanf("%lld",&g[i]);
		}
		for (int i=1;i<=n;i++){
			scanf("%lld",&h[i]);
		}
		
		if (n==1) {
			printf("YES\n");
			continue;
		}
		if (h[1]==g[1]) {
			printf("NO\n");
			continue;
		}
		else if (n==2) {
			if (h[1]>g[1]&&h[2]==g[2]) printf("YES\n");
			else printf("NO\n");
			continue;
		}//13 17
		for (int i=1;i<=n;i++){
			int u=h[i]-g[i];
			win+=u;
			g[i]=g[i]-2*u;
		}
		if (win<n) {
			printf("NO\n");
			continue;
		}
		sort(g+1,g+n+1);
		ll sum=0;
		for (int i=1;i<n;i++)
		sum+=g[i];
		printf("YES\n");
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 1724kb

input:

2
3
4 1 1
6 1 1
4
5 1 1 1
7 1 1 1

output:

NO
NO

result:

wrong answer expected YES, found NO [1st token]