Submission #147506

# Submission time Handle Problem Language Result Execution time Memory
147506 2019-08-29T20:59:27 Z ipaljak Jarvis (COCI19_jarvis) C++14
70 / 70
51 ms 3064 KB
#include <bits/stdc++.h>

using namespace std;

#define TRACE(x) cerr << #x << " " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<

typedef long long llint;

const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 10;

int n;
int a[MAXN], b[MAXN];

map<int, int> cnt;

int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < n; ++i) scanf("%d", &b[i]);
  for (int i = 0; i < n; ++i) cnt[a[i] - b[i]]++;

  int sol = 0;
  for (const auto &kv : cnt) sol = max(sol, kv.second);
  printf("%d\n", sol);
  return 0;
}

Compilation message

jarvis.cpp: In function 'int main()':
jarvis.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &n);
   ~~~~~^~~~~~~~~~
jarvis.cpp:22:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
                               ~~~~~^~~~~~~~~~~~~
jarvis.cpp:23:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for (int i = 0; i < n; ++i) scanf("%d", &b[i]);
                               ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 23 ms 1528 KB Output is correct
3 Correct 23 ms 1656 KB Output is correct
4 Correct 23 ms 1532 KB Output is correct
5 Correct 34 ms 2552 KB Output is correct
6 Correct 36 ms 2552 KB Output is correct
7 Correct 37 ms 2552 KB Output is correct
8 Correct 38 ms 2556 KB Output is correct
9 Correct 50 ms 3064 KB Output is correct
10 Correct 51 ms 3036 KB Output is correct