Submission #160622

#TimeUsernameProblemLanguageResultExecution timeMemory
16062244442Jarvis (COCI19_jarvis)C++11
70 / 70
93 ms8056 KiB
#include <bits/stdc++.h>
using namespace std;
long long n,a[100004],b[100004],maxx,c,e,d;
multiset<long long>s;
int main (){
ios::sync_with_stdio(0);
     scanf("%lld\n",&n);
     for(int i=0;i<n;i++){
     	 scanf("%lld",&a[i]);
     }
     for(int i=0;i<n;i++){
     	 scanf("%lld",&b[i]);
     	 c=b[i]-a[i];
     	 s.insert(c);
	 }
	 multiset<long long>::iterator it;
	 while(!s.empty()){
	 	 d=s.size();
		 it=s.begin();
		 s.erase(*it);
		 e=s.size();
		 maxx=max(maxx,d-e);
     }
	 printf("%lld",maxx);
return 0;
}

Compilation message (stderr)

jarvis.cpp: In function 'int main()':
jarvis.cpp:7:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
      scanf("%lld\n",&n);
      ~~~~~^~~~~~~~~~~~~
jarvis.cpp:9:13: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
        scanf("%lld",&a[i]);
        ~~~~~^~~~~~~~~~~~~~
jarvis.cpp:12:13: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
        scanf("%lld",&b[i]);
        ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...