QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#50122 | #871. Interesting Scoring Systems | Sparky327 | WA | 1ms | 1724kb | C++ | 877b | 2022-09-24 16:56:02 | 2022-09-24 16:56:02 |
Judging History
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]