Submission #1100214

#TimeUsernameProblemLanguageResultExecution timeMemory
1100214owieczkaJust Long Neckties (JOI20_ho_t1)C++17
0 / 100
1 ms2388 KiB
#include <bits/stdc++.h>
using namespace std;

int neckties[200'005];
int employees[200'005];
int strangeness[200'005];

int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);
   int n;
   cin >> n;
   for (int i = 0; i <= n; i++)
   {
      cin >> neckties[i];
   }
   for (int i = 0; i < n; i++)
   {
      cin >> employees[i];
   }
   sort (neckties, neckties + n + 1);
   sort (employees, employees + n);
   for (int i = n+1; i > 0; i--)
   {
      strangeness[i] = max(strangeness[i+1], neckties[i] - employees[i-1]);
   }
   int str = 0;
   for (int i = 0; i <= n; i++)
   {
      cout << max (str, strangeness[i+1]) << ' ';
      str = max(str, neckties[i] - employees[i]);
   }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...