General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
119128886 Practice:
unt311
1133D - 26 GNU C++17 (64) Wrong answer on test 27 218 ms 17340 KB 2021-06-11 10:43:29 2021-06-11 10:43:29
 
 
→ Source
#include "bits/stdc++.h"
#define int long long
using namespace std;

int d[200001];
const int mod = 1e9 + 7;

int pw(int a, int b){
    int ret = 1 % mod;
    a %= mod;
    while(b) {
        if(b & 1LL) ret = ret * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ret;
}
int inv(int a){
    return pw(a, mod - 2);
}
int mul(int a, int b){
    return (a * b) % mod;
}
signed main(){  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int n;
    cin>>n;
    vector<int> a(n), b(n);

    for(auto&x: a){
        cin>>x;
    }

    for(auto&x: b){
        cin>>x;
    }

    for(int i{}; i < n; ++i){
        d[i] = mul(b[i], inv(a[i]));
    }

    map<int,int> freq;
    int ans = 0, add = 0;
    for(int i{}; i < n; ++i){
        if(!a[i]){
            if(!b[i])
                ++add;
            continue;
        }
        ++freq[d[i]];
        ans = max(ans, freq[d[i]]);
    }
    cout<<(ans + add)<<'\n';

    return 0;
}
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details