제출 #219560

#제출 시각아이디문제언어결과실행 시간메모리
219560MKopchevJust Long Neckties (JOI20_ho_t1)C++14
0 / 100
5 ms384 KiB
#include<bits/stdc++.h> using namespace std; const int nmax=2e5+42; int n,inp[nmax],other[nmax]; int pref[nmax],suff[nmax]; int main() { scanf("%i",&n); for(int i=1;i<=n+1;i++)scanf("%i",&inp[i]); for(int i=1;i<=n;i++)scanf("%i",&other[i]); sort(inp+1,inp+n+2); sort(other+1,other+n+1); for(int i=1;i<=n;i++) pref[i]=max(pref[i-1],inp[i]-other[i]); for(int i=n+1;i>=2;i--) suff[i]=max(suff[i+1],inp[i]-other[i-1]); /* for(int i=1;i<=n;i++)cout<<pref[i]<<" ";cout<<endl; for(int i=1;i<=n+1;i++)cout<<suff[i]<<" ";cout<<endl; */ for(int i=1;i<=n+1;i++) { printf("%i",max(pref[i-1],suff[i+1])); if(i==n+1)printf("\n"); else printf(" "); } return 0; }

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

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i",&n);
     ~~~~~^~~~~~~~~
ho_t1.cpp:10:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1;i<=n+1;i++)scanf("%i",&inp[i]);
                            ~~~~~^~~~~~~~~~~~~~
ho_t1.cpp:11:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1;i<=n;i++)scanf("%i",&other[i]);
                          ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...