Submission #365176

#TimeUsernameProblemLanguageResultExecution timeMemory
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; }

Compilation message (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...