Submission #313935

#TimeUsernameProblemLanguageResultExecution timeMemory
313935phathnvJarvis (COCI19_jarvis)C++11
70 / 70
50 ms3064 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...