Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by asas ( 7 years ago )
#include <bits/stdc++.h>			

using namespace std;

int n, a[300123], b[300123];
map<long double, int> cnt;

int main() {
  scanf("%d", &n);
  for(int i = 1; i <= n; i ++)
    scanf("%d", &a[i]);
	for(int i = 1; i <= n; i ++)
	  scanf("%d", &b[i]);
	int mx = 0, cnt0 = 0;
	for(int i = 1; i <= n; i ++) {
	  if(b[i] == 0) {
	    cnt0 ++;
	    continue;
	  }
	  if(a[i] == 0)
	    continue;
	  long double cur = (-1.0 * b[i]) / (1.0 * a[i]);
	  cnt[cur] ++;
	  mx = max(mx, cnt[cur]);
	}
	mx = max(mx, cnt0);
	printf("%d", mx);
	return 0;  
}

 

Revise this Paste

Your Name: Code Language: