Submission #120945

# Submission time Handle Problem Language Result Execution time Memory
120945 2019-06-25T19:37:22 Z kimbj0709 Jarvis (COCI19_jarvis) C++17
70 / 70
82 ms 3372 KB
#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

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 time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 41 ms 2416 KB Output is correct
3 Correct 42 ms 2416 KB Output is correct
4 Correct 39 ms 2288 KB Output is correct
5 Correct 73 ms 3308 KB Output is correct
6 Correct 82 ms 3372 KB Output is correct
7 Correct 74 ms 3284 KB Output is correct
8 Correct 76 ms 3316 KB Output is correct
9 Correct 77 ms 3312 KB Output is correct
10 Correct 78 ms 3312 KB Output is correct