QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#50114#871. Interesting Scoring SystemsSparky327WA 79ms1876kbC++917b2022-09-24 16:51:152022-09-24 16:51:17

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:51:17]
  • 评测
  • 测评结果:WA
  • 用时:79ms
  • 内存:1876kb
  • [2022-09-24 16:51:15]
  • 提交

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("NO0\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-1) {
			printf("NO\n");
			continue;
		}
		sort(g+1,g+n+1);
		ll sum=0;
		for (int i=1;i<n;i++)
		sum+=g[i];
		if(sum<g[n]) printf("NO\n");
		else printf("YES\n");
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

YES
NO

result:

ok 2 token(s): yes count is 1, no count is 1

Test #2:

score: 0
Accepted
time: 1ms
memory: 1876kb

input:

2
4
5 3 1 3
7 4 1 3
1
0
0

output:

YES
YES

result:

ok 2 token(s): yes count is 2, no count is 0

Test #3:

score: -100
Wrong Answer
time: 79ms
memory: 1840kb

input:

10000
64
2 2 1 4 1 7 5 0 4 7 4 3 0 6 2 3 3 2 5 2 4 3 2 9 4 2 5 1 0 1 2 4 0 5 5 4 4 0 0 2 0 3 2 5 5 6 5 0 5 0 3 0 3 6 5 4 0 6 7 3 4 4 2 2
3 2 1 5 1 10 7 0 6 10 6 4 0 8 3 4 4 3 7 3 6 4 2 13 6 3 7 1 0 1 3 6 0 7 7 5 6 0 0 3 0 4 2 7 7 9 7 0 7 0 4 0 4 8 7 5 0 9 10 4 6 5 3 3
99
98 79 89 106 103 91 89 105 9...

output:

YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
NO
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
...

result:

wrong answer expected YES, found NO [37th token]