Submission #313935

# Submission time Handle Problem Language Result Execution time Memory
313935 2020-10-17T11:08:37 Z phathnv Jarvis (COCI19_jarvis) C++11
70 / 70
50 ms 3064 KB
#include <bits/stdc++.h>

#define mp make_pair
#define X first
#define Y second
#define taskname "JARVIS"

using namespace std;

typedef long long ll;
typedef pair <int, int> ii;

const int N = 1e5 + 1;

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

void readInput(){
    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]);
}

void solve(){
    map<int, int> d;
    for(int i = 1; i <= n; i++)
        d[a[i] - b[i]]++;
    int res = 0;
    for(ii x : d)
        res = max(res, x.Y);
    printf("%d", res);
}

int main(){
    if (fopen(taskname".inp", "r")){
        freopen(taskname".inp", "r", stdin);
        freopen(taskname".out", "w", stdout);
    }
    readInput();
    solve();
    return 0;
}

Compilation message

jarvis.cpp: In function 'void readInput()':
jarvis.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
jarvis.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   20 |         scanf("%d", &a[i]);
      |         ~~~~~^~~~~~~~~~~~~
jarvis.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   22 |         scanf("%d", &b[i]);
      |         ~~~~~^~~~~~~~~~~~~
jarvis.cpp: In function 'int main()':
jarvis.cpp:37:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   37 |         freopen(taskname".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
jarvis.cpp:38:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   38 |         freopen(taskname".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 25 ms 1536 KB Output is correct
3 Correct 26 ms 1536 KB Output is correct
4 Correct 24 ms 1536 KB Output is correct
5 Correct 36 ms 2552 KB Output is correct
6 Correct 37 ms 2512 KB Output is correct
7 Correct 40 ms 2552 KB Output is correct
8 Correct 40 ms 2552 KB Output is correct
9 Correct 49 ms 3064 KB Output is correct
10 Correct 50 ms 2936 KB Output is correct