Advertisement
dmkozyrev

d.cpp

Apr 5th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. #inlude <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. const int MOD = (int)1e9+7;
  6.  
  7. int count_zeros(const vector<int>& a) {
  8.     int answ = 0; for (auto it : a) answ += it == 0; return answ;
  9. }
  10.  
  11. int main() {
  12.     int n, nLetters; cin >> n >> nLetters;
  13.    
  14.     vector<int> a(n), b(n);
  15.     for (auto& it : a) cin >> it;
  16.     for (auto& it : b) cin >> it;
  17.    
  18.     int64_t P = 0, Q = count_zeros(a) + count_zeros(b);
  19.     int64_t q = Q;
  20.     int64_t mul = 1;
  21.    
  22.     for (int i = 0; i < n; ++i) {
  23.         if (a[i] > 0 && b[i] > 0) {
  24.             if (a[i] > b[i]) {
  25.                 P = P + mul * q;
  26.                 break;
  27.             } else if (a[i] < b[i]) {
  28.                 break;
  29.             }
  30.         } else if (a[i] > 0 && b[i] == 0) {
  31.             P = P + mul * (a[i]-1) * q;
  32.             mul = 1;
  33.         } else if (a[i] == 0 && b[i] > 0) {
  34.        
  35.         } else if (a[i] == 0 && b[i] == 0) {
  36.        
  37.         }
  38.     }
  39.    
  40.    
  41.    
  42.     return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement