QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#202639#871. Interesting Scoring SystemsisaunoyaWA 1ms3612kbC++23777b2023-10-06 12:45:002023-10-06 12:45:01

Judging History

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

  • [2023-10-06 12:45:01]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3612kb
  • [2023-10-06 12:45:00]
  • 提交

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]