답안 #160622

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
160622 2019-10-28T21:35:25 Z 44442 Jarvis (COCI19_jarvis) C++11
70 / 70
93 ms 8056 KB
#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

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]);
        ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 52 ms 7160 KB Output is correct
3 Correct 49 ms 7032 KB Output is correct
4 Correct 48 ms 7160 KB Output is correct
5 Correct 55 ms 8056 KB Output is correct
6 Correct 64 ms 8056 KB Output is correct
7 Correct 78 ms 8056 KB Output is correct
8 Correct 79 ms 8056 KB Output is correct
9 Correct 93 ms 8056 KB Output is correct
10 Correct 89 ms 8056 KB Output is correct