제출 #365176

#제출 시각아이디문제언어결과실행 시간메모리
365176jazzupJust Long Neckties (JOI20_ho_t1)C++17
9 / 100
1085 ms6444 KiB
#include<cstdio>
#include<algorithm>

using namespace std;

int a[200010],aa[200010],b[200010];

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<=n;i++){
		scanf("%d",&aa[i]);
		a[i]=aa[i];
	}
	sort(a,a+n+1);
	for(int i=0;i<n;i++){
		scanf("%d",&b[i]);
	}
	sort(b,b+n);
	for(int i=0;i<=n;i++){
		int ans=0;
		int p=aa[i];
		bool d=false;
		for(int j=0;j<=n;j++){
			if(!d){
				if(a[j]==p){
					d=true;
					continue;
				}
				ans=max(ans,max(a[j]-b[j],0));
			}
			else
				ans=max(ans,max(a[j]-b[j-1],0));

		}
		printf("%d ",ans);
	}
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |  scanf("%d",&n);
      |  ~~~~~^~~~~~~~~
ho_t1.cpp:12:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |   scanf("%d",&aa[i]);
      |   ~~~~~^~~~~~~~~~~~~
ho_t1.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |   scanf("%d",&b[i]);
      |   ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...