답안 #96594

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
96594 2019-02-10T11:37:35 Z psmao Jarvis (COCI19_jarvis) C++14
70 / 70
36 ms 5112 KB
#include <bits/stdc++.h>
using namespace std;

#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)
#define bf(i,s) for(int i = head[s]; i; i = e[i].next)
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define VI vector<int>
#define sf scanf
#define pf printf
#define fp freopen
#define SZ(x) ((int)(x).size())
#ifdef MPS
#define D(x...) printf(x)
#else
#define D(x...)
#endif
typedef long long ll;
typedef double db;
typedef unsigned long long ull;
const int inf = 1<<30;
const ll INF = 1ll<<60;
const db Inf = 1e20;
const db eps = 1e-9;

void gmax(int &a,int b){a = (a > b ? a : b);}
void gmin(int &a,int b){a = (a < b ? a : b);}

const int maxn = 100050;
const int maxm = 1000000;

int n, cnt[maxm*2+1];
int a[maxn], b[maxn];

int main()
{
	#ifdef MPS	
		fp("1.in","r",stdin);
		fp("1.out","w",stdout);
	#endif
	sf("%d",&n);
	fo(i,1,n) sf("%d",&a[i]);
	fo(i,1,n) sf("%d",&b[i]);
	fo(i,1,n) cnt[a[i]-b[i]+maxm] ++;
	int ans = 0;
	fo(i,0,maxm*2) gmax(ans, cnt[i]);
	pf("%d\n",ans);
	return 0;
}

Compilation message

jarvis.cpp: In function 'int main()':
jarvis.cpp:45:4: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  sf("%d",&n);
    ^
jarvis.cpp:46:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  fo(i,1,n) sf("%d",&a[i]);
              ^
jarvis.cpp:47:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  fo(i,1,n) sf("%d",&b[i]);
              ^
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 380 KB Output is correct
2 Correct 22 ms 1144 KB Output is correct
3 Correct 21 ms 1144 KB Output is correct
4 Correct 21 ms 1144 KB Output is correct
5 Correct 32 ms 1144 KB Output is correct
6 Correct 31 ms 1272 KB Output is correct
7 Correct 32 ms 1532 KB Output is correct
8 Correct 31 ms 1528 KB Output is correct
9 Correct 35 ms 4984 KB Output is correct
10 Correct 36 ms 5112 KB Output is correct