Submission #202288

# Submission time Handle Problem Language Result Execution time Memory
202288 2020-02-15T07:15:02 Z lukameladze Just Long Neckties (JOI20_ho_t1) C++14
9 / 100
311 ms 24700 KB
# include <bits/stdc++.h>
using namespace std;
long long n,ans[200005],b[200005];
pair <long long, long long > a[20005];
multiset <long long > ms;
int main()
{
	cin>>n;
	for (int i=1; i<=n+1; i++)
	{
		cin>>a[i].first;
		a[i].second=i;
	}
	for (int i=1; i<=n; i++)
	{
		cin>>b[i];
	}
	sort(a+1,a+n+2);
	sort(b+1, b+n+1);
	for (int i=1; i<=n; i++)
	{
		ms.insert(a[i].first-b[i]);
	}
	for (int i=n+1; i>=1; i--)
	{
		ans[a[i].second]=*(--ms.end());
		if (i>1)
		{
			ms.erase(ms.find(a[i-1].first-b[i-1]));
			ms.insert(a[i].first-b[i-1]);
		}
	}
	for (int i=1; i<=n+1; i++)
	{
		cout<<ans[i]<<" ";
	}
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 12 ms 376 KB Output is correct
14 Correct 7 ms 376 KB Output is correct
15 Correct 7 ms 504 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 8 ms 504 KB Output is correct
18 Correct 8 ms 504 KB Output is correct
19 Correct 8 ms 504 KB Output is correct
20 Correct 9 ms 508 KB Output is correct
21 Correct 8 ms 504 KB Output is correct
22 Correct 8 ms 504 KB Output is correct
23 Correct 8 ms 504 KB Output is correct
24 Correct 8 ms 504 KB Output is correct
25 Correct 8 ms 504 KB Output is correct
26 Correct 8 ms 504 KB Output is correct
27 Correct 8 ms 504 KB Output is correct
28 Correct 8 ms 504 KB Output is correct
29 Correct 8 ms 508 KB Output is correct
30 Correct 8 ms 504 KB Output is correct
31 Correct 8 ms 504 KB Output is correct
32 Correct 8 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 12 ms 376 KB Output is correct
14 Correct 7 ms 376 KB Output is correct
15 Correct 7 ms 504 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 8 ms 504 KB Output is correct
18 Correct 8 ms 504 KB Output is correct
19 Correct 8 ms 504 KB Output is correct
20 Correct 9 ms 508 KB Output is correct
21 Correct 8 ms 504 KB Output is correct
22 Correct 8 ms 504 KB Output is correct
23 Correct 8 ms 504 KB Output is correct
24 Correct 8 ms 504 KB Output is correct
25 Correct 8 ms 504 KB Output is correct
26 Correct 8 ms 504 KB Output is correct
27 Correct 8 ms 504 KB Output is correct
28 Correct 8 ms 504 KB Output is correct
29 Correct 8 ms 508 KB Output is correct
30 Correct 8 ms 504 KB Output is correct
31 Correct 8 ms 504 KB Output is correct
32 Correct 8 ms 504 KB Output is correct
33 Runtime error 311 ms 24700 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Halted 0 ms 0 KB -