QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#202639 | #871. Interesting Scoring Systems | isaunoya | WA | 1ms | 3612kb | C++23 | 777b | 2023-10-06 12:45:00 | 2023-10-06 12:45:01 |
Judging History
answer
#include<iostream>
#include<cstdio>
using namespace std;
const int N=1000005;
int n;
int a[N],b[N],c[N];
void solve()
{
cin>>n;
for(int i=1;i<=n;i++)
cin>>a[i];
for(int i=1;i<=n;i++)
cin>>b[i];
for(int i=1;i<=n;i++)
c[i]=b[i]-a[i];
for(int i=1;i<=n;i++)
if(c[i]<0)
{
cout<<"NO\n";
return;
}
if(c[1]==0)
{
cout<<"NO\n";
return;
}
if(n==2)
{
if(c[2]==0) cout<<"YES\n";
else cout<<"NO\n";
return;
}
int cnt=0;
for(int i=1;i<=n;i++)
cnt+=c[i];
if(cnt>=n-1) cout<<"YES\n";
else cout<<"NO\n";
return;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr),cout.tie(nullptr);
int T;
cin>>T;
while(T--)
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3612kb
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: -100
Wrong Answer
time: 0ms
memory: 3508kb
input:
2 4 5 3 1 3 7 4 1 3 1 0 0
output:
YES NO
result:
wrong answer expected YES, found NO [2nd token]