Submission #120945

#TimeUsernameProblemLanguageResultExecution timeMemory
120945kimbj0709Jarvis (COCI19_jarvis)C++17
70 / 70
82 ms3372 KiB
#include <bits/stdc++.h> using namespace std; int main() { int no_of_input; int input; vector<int> vect1; vector<int> vect2; vector<int> vect3; cin >> no_of_input; for(int i=0;i<no_of_input;i++){ cin >> input; vect1.push_back(input); } for(int i=0;i<no_of_input;i++){ cin >> input; vect2.push_back(input); } for(int i=0;i<no_of_input;i++){ vect3.push_back(vect1[i]-vect2[i]); } sort(vect3.begin(),vect3.end()); int rn = vect3[0]; int counter = 1; int maximum = 0; for(int i=1;i<vect3.size();i++){ if(vect3[i]==rn){ counter++; } else{ maximum = max(maximum,counter); counter = 1; rn = vect3[i]; } } maximum = max(maximum,counter); cout << maximum; }

Compilation message (stderr)

jarvis.cpp: In function 'int main()':
jarvis.cpp:26:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=1;i<vect3.size();i++){
               ~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...