Submission #1023787

# Submission time Handle Problem Language Result Execution time Memory
1023787 2024-07-15T06:37:20 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
9 / 100
1000 ms 8552 KB
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define vec vector
#define int long long
#define inf 1e18
const int mod = 998244353 , men = 1e9 + 7;
/*
▀█████████▄   ▄█   ▄█          ▄████████  ▄█        ▄████████  ▄██████▄  ████████▄     ▄████████    ▄████████ 
  ███    ███ ███  ███         ███    ███ ███       ███    ███ ███    ███ ███   ▀███   ███    ███   ███    ███ 
  ███    ███ ███▌ ███         ███    ███ ███       ███    █▀  ███    ███ ███    ███   ███    █▀    ███    ███ 
 ▄███▄▄▄██▀  ███▌ ███         ███    ███ ███       ███        ███    ███ ███    ███  ▄███▄▄▄      ▄███▄▄▄▄██▀ 
▀▀███▀▀▀██▄  ███▌ ███       ▀███████████ ███       ███        ███    ███ ███    ███ ▀▀███▀▀▀     ▀▀███▀▀▀▀▀   
  ███    ██▄ ███  ███         ███    ███ ███       ███    █▄  ███    ███ ███    ███   ███    █▄  ▀███████████ 
  ███    ███ ███  ███▌    ▄   ███    ███ ███▌    ▄ ███    ███ ███    ███ ███   ▄███   ███    ███   ███    ███ 
▄█████████▀  █▀   █████▄▄██   ███    █▀  █████▄▄██ ████████▀   ▀██████▀  ████████▀    ██████████   ███    ███ 
				  ▀                      ▀                                                         ███    ███ 
*/
template<typename _T>
bool chmin(_T &a, const _T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <typename _T>
bool chmax(_T &a, const _T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
double dist(double x1 , double y1 , double x2 , double y2){
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));	
}
inline void io(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
}
inline void solve(){
	int n;
	cin >> n;
	vector<int> a(n + 1) , b(n);
	for (auto & x : a)
		cin >> x;
	for (auto & x : b)
		cin >> x;
	sort(b.begin() , b.end());
	for (int i = 0; i <= n; i++){
		int res = 0;
		vector<int> aa = a;
		aa.erase(aa.begin() + i);
		sort(aa.begin() , aa.end());
		for (int i = 0; i < n; i++)
			chmax(res , aa[i] - b[i]);
		cout << res << " ";
	}
}
signed main() {
	io();
    int t = 1;
    //~ cin >> t;
    while(t--)
        solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 14 ms 348 KB Output is correct
15 Correct 41 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 77 ms 536 KB Output is correct
18 Correct 55 ms 348 KB Output is correct
19 Correct 66 ms 504 KB Output is correct
20 Correct 53 ms 344 KB Output is correct
21 Correct 58 ms 516 KB Output is correct
22 Correct 53 ms 348 KB Output is correct
23 Correct 82 ms 344 KB Output is correct
24 Correct 60 ms 600 KB Output is correct
25 Correct 97 ms 536 KB Output is correct
26 Correct 93 ms 516 KB Output is correct
27 Correct 77 ms 344 KB Output is correct
28 Correct 85 ms 348 KB Output is correct
29 Correct 84 ms 348 KB Output is correct
30 Correct 88 ms 508 KB Output is correct
31 Correct 105 ms 348 KB Output is correct
32 Correct 107 ms 516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 14 ms 348 KB Output is correct
15 Correct 41 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 77 ms 536 KB Output is correct
18 Correct 55 ms 348 KB Output is correct
19 Correct 66 ms 504 KB Output is correct
20 Correct 53 ms 344 KB Output is correct
21 Correct 58 ms 516 KB Output is correct
22 Correct 53 ms 348 KB Output is correct
23 Correct 82 ms 344 KB Output is correct
24 Correct 60 ms 600 KB Output is correct
25 Correct 97 ms 536 KB Output is correct
26 Correct 93 ms 516 KB Output is correct
27 Correct 77 ms 344 KB Output is correct
28 Correct 85 ms 348 KB Output is correct
29 Correct 84 ms 348 KB Output is correct
30 Correct 88 ms 508 KB Output is correct
31 Correct 105 ms 348 KB Output is correct
32 Correct 107 ms 516 KB Output is correct
33 Execution timed out 1084 ms 8552 KB Time limit exceeded
34 Halted 0 ms 0 KB -