Submission #19575433


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

const int MOD = 1000000007;
const int INF = 1e9;
const long long INFLL = 1e18;
using ll = long long;

int main(){
  int n;
  cin >> n;
  vector<ll> a(n), b(n);
  ll suma = 0, sumb = 0;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    suma += a[i];
  }
  for(int i = 0; i < n; i++) {
    cin >> b[i];
    sumb += b[i];
  }

  ll cnta = sumb - suma;
  ll cntb = sumb - suma;
  string ans = "Yes";
  for(int i = 0; i < n - 1; i++){
    if(a[i] > b[i]){
      cntb -= a[i] - b[i];
    }else{
      if((b[i] - a[i]) % 2 == 0){
        cnta -= (b[i] - a[i]) / 2;
      }else{
        cnta -= (b[i] - a[i] + 1) / 2;
        cntb -= 1;
      }
    }
  }
  if(cnta < 0 || cntb < 0) ans = "No";
  else if(a[n-1] * 2 * cnta != b[n-1] * cntb) ans = "No";

  cout << ans << endl;

  return 0;
}

Submission Info

Submission Time
Task B - Two Arrays
User odango3
Language C++ (GCC 9.2.1)
Score 0
Code Size 874 Byte
Status WA
Exec Time 19 ms
Memory 3788 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 16
WA × 12
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt
Case Name Status Exec Time Memory
0_000.txt AC 7 ms 3500 KB
0_001.txt AC 5 ms 3628 KB
0_002.txt AC 2 ms 3576 KB
1_003.txt WA 18 ms 3680 KB
1_004.txt AC 11 ms 3756 KB
1_005.txt AC 14 ms 3596 KB
1_006.txt WA 14 ms 3752 KB
1_007.txt AC 14 ms 3756 KB
1_008.txt AC 13 ms 3648 KB
1_009.txt AC 17 ms 3692 KB
1_010.txt AC 13 ms 3708 KB
1_011.txt AC 16 ms 3732 KB
1_012.txt AC 16 ms 3716 KB
1_013.txt AC 14 ms 3644 KB
1_014.txt WA 13 ms 3712 KB
1_015.txt AC 17 ms 3708 KB
1_016.txt AC 16 ms 3732 KB
1_017.txt AC 14 ms 3600 KB
1_018.txt WA 16 ms 3648 KB
1_019.txt AC 19 ms 3652 KB
1_020.txt WA 14 ms 3708 KB
1_021.txt WA 16 ms 3712 KB
1_022.txt WA 13 ms 3708 KB
1_023.txt WA 13 ms 3640 KB
1_024.txt WA 15 ms 3648 KB
1_025.txt WA 13 ms 3760 KB
1_026.txt WA 13 ms 3732 KB
1_027.txt WA 15 ms 3788 KB