Submission #222451

#TimeUsernameProblemLanguageResultExecution timeMemory
222451astoriaJust Long Neckties (JOI20_ho_t1)C++14
0 / 100
4 ms256 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int a[n+1]; for(int i=0; i<n+1; i++) cin>>a[i]; int b[n]; for(int i=0; i<n; i++) cin>>b[i]; sort(b,b+n); sort(a,a+n+1); int eq[n],abv[n]; for(int i=0; i<n; i++){ eq[i] = max(a[i]-b[i],0); abv[i] = max(a[i+1]-b[i],0); } int mx=0; for(int i=0; i<n; i++) mx = max(mx, eq[i]); vector<int> v; v.push_back(mx); for(int i=n-1; i>=0; i--){ mx = max(mx, abv[i]); v.push_back(mx); } reverse(v.begin(),v.end()); for(int i=0; i<=n; i++) cout<<v[i]<<' '; }

Compilation message (stderr)

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:9:6: warning: argument 1 range [18446744065119617024, 18446744073709551612] exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  int b[n];
      ^
ho_t1.cpp:9:6: note: in a call to built-in allocation function 'void* __builtin_alloca_with_align(long unsigned int, long unsigned int)'
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...