Submission #528095

# Submission time Handle Problem Language Result Execution time Memory
528095 2022-02-19T08:41:22 Z aris12345678 Jarvis (COCI19_jarvis) C++14
70 / 70
39 ms 1132 KB
#include <bits/stdc++.h>
using namespace std;

#define X first
#define Y second

int main() {
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    for(int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    map<int, int> mp;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        int b;
        scanf("%d", &b);
        mp[b-a[i]]++;
        ans = max(ans, mp[b-a[i]]);
    }
    printf("%d\n", ans);
    return 0;
}

Compilation message

jarvis.cpp: In function 'int main()':
jarvis.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
jarvis.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%d", &a[i]);
      |         ~~~~~^~~~~~~~~~~~~
jarvis.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         scanf("%d", &b);
      |         ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 17 ms 588 KB Output is correct
3 Correct 16 ms 588 KB Output is correct
4 Correct 16 ms 588 KB Output is correct
5 Correct 20 ms 696 KB Output is correct
6 Correct 22 ms 692 KB Output is correct
7 Correct 24 ms 692 KB Output is correct
8 Correct 24 ms 588 KB Output is correct
9 Correct 37 ms 1132 KB Output is correct
10 Correct 39 ms 1100 KB Output is correct