Submission #762904

# Submission time Handle Problem Language Result Execution time Memory
762904 2023-06-22T01:12:13 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++14
9 / 100
1000 ms 6848 KB
#include <bits/stdc++.h>
#define ii pair<int,int>
#define f first
#define s second
#define pb push_back
#define int long long
#define endl '\n'
using namespace std;
const int MAXN = 1e18;
int mod = 1e9 + 7;
int a[200005];
int b[200005];
void AcSolution()
{
	int n;
	cin >> n;
	for(int i = 1;i <= n + 1;i++)
	{
		cin >> a[i];
	}
	for(int i = 1;i <= n;i++)
	{
		cin >> b[i];
	}
	sort(b + 1,b + n + 1);
	for(int i = 1;i <= n + 1;i++)
	{
		vector<int> c;
		c.push_back(0);
		for(int j = 1;j <= n + 1;j++)
		{
			if(j != i)
			{
				c.push_back(a[j]);
			}
		}
		sort(c.begin(),c.end());
		int ma = INT_MIN;
		for(int k = 1;k <= n;k++)
		{
			ma = max(ma,max(c[k] - b[k],0ll));
		}
		cout << ma << " ";
	}
	cout << endl;
}
signed main()
{
//	ifstream cin("A.inp");
//    ofstream cout("A.ans");
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
//	cin >> t;
	while(t--)
	{
	 	AcSolution();
	}
}


# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 21 ms 368 KB Output is correct
15 Correct 70 ms 376 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 123 ms 396 KB Output is correct
18 Correct 87 ms 392 KB Output is correct
19 Correct 92 ms 392 KB Output is correct
20 Correct 91 ms 384 KB Output is correct
21 Correct 96 ms 388 KB Output is correct
22 Correct 88 ms 396 KB Output is correct
23 Correct 87 ms 340 KB Output is correct
24 Correct 100 ms 380 KB Output is correct
25 Correct 135 ms 400 KB Output is correct
26 Correct 126 ms 380 KB Output is correct
27 Correct 123 ms 388 KB Output is correct
28 Correct 134 ms 380 KB Output is correct
29 Correct 108 ms 380 KB Output is correct
30 Correct 121 ms 388 KB Output is correct
31 Correct 140 ms 388 KB Output is correct
32 Correct 157 ms 388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 21 ms 368 KB Output is correct
15 Correct 70 ms 376 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 123 ms 396 KB Output is correct
18 Correct 87 ms 392 KB Output is correct
19 Correct 92 ms 392 KB Output is correct
20 Correct 91 ms 384 KB Output is correct
21 Correct 96 ms 388 KB Output is correct
22 Correct 88 ms 396 KB Output is correct
23 Correct 87 ms 340 KB Output is correct
24 Correct 100 ms 380 KB Output is correct
25 Correct 135 ms 400 KB Output is correct
26 Correct 126 ms 380 KB Output is correct
27 Correct 123 ms 388 KB Output is correct
28 Correct 134 ms 380 KB Output is correct
29 Correct 108 ms 380 KB Output is correct
30 Correct 121 ms 388 KB Output is correct
31 Correct 140 ms 388 KB Output is correct
32 Correct 157 ms 388 KB Output is correct
33 Execution timed out 1084 ms 6848 KB Time limit exceeded
34 Halted 0 ms 0 KB -