Submission #1023732

# Submission time Handle Problem Language Result Execution time Memory
1023732 2024-07-15T05:39:54 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
9 / 100
1000 ms 8576 KB
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define f first
#define s second
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
using namespace std;
const int mod = 998244353;
void solve() {
    int n, s;
    cin >> n;
    vector <int> v(n + 1), a(n);
    for (int i = 0; i <= n; i++) {
        cin >> v[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
	vector <int> ans;
	for (int i = 0 ; i <= n; i++) {
		int mx = 0;
		vector <int> idivjopu(n);
		int k = 0;
		for (int j = 0; j < n + 1; j++) {
			if (j == i) continue;
			idivjopu[k] = v[j];
			k++;
		}
		sort(idivjopu.begin(), idivjopu.end());
		for (int j = 0; j < n; j++) {
			mx = max(idivjopu[j] - a[j], mx);
		}
		ans.pb(mx);
	}
    for (int i = 0; i <= n; i++) {
    	cout << ans[i] << " ";
	}
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}

Compilation message

ho_t1.cpp: In function 'void solve()':
ho_t1.cpp:5:11: warning: unused variable 'second' [-Wunused-variable]
    5 | #define s second
      |           ^~~~~~
ho_t1.cpp:11:12: note: in expansion of macro 's'
   11 |     int n, s;
      |            ^
# Verdict Execution time Memory Grader output
1 Correct 0 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 1 ms 348 KB Output is correct
6 Correct 0 ms 456 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 0 ms 348 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 0 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 1 ms 348 KB Output is correct
6 Correct 0 ms 456 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 0 ms 348 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 13 ms 504 KB Output is correct
15 Correct 41 ms 520 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 77 ms 540 KB Output is correct
18 Correct 54 ms 528 KB Output is correct
19 Correct 61 ms 348 KB Output is correct
20 Correct 52 ms 520 KB Output is correct
21 Correct 58 ms 344 KB Output is correct
22 Correct 52 ms 344 KB Output is correct
23 Correct 57 ms 664 KB Output is correct
24 Correct 59 ms 528 KB Output is correct
25 Correct 89 ms 532 KB Output is correct
26 Correct 89 ms 344 KB Output is correct
27 Correct 76 ms 344 KB Output is correct
28 Correct 87 ms 348 KB Output is correct
29 Correct 65 ms 532 KB Output is correct
30 Correct 74 ms 532 KB Output is correct
31 Correct 95 ms 344 KB Output is correct
32 Correct 103 ms 540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 1 ms 348 KB Output is correct
6 Correct 0 ms 456 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 0 ms 348 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 13 ms 504 KB Output is correct
15 Correct 41 ms 520 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 77 ms 540 KB Output is correct
18 Correct 54 ms 528 KB Output is correct
19 Correct 61 ms 348 KB Output is correct
20 Correct 52 ms 520 KB Output is correct
21 Correct 58 ms 344 KB Output is correct
22 Correct 52 ms 344 KB Output is correct
23 Correct 57 ms 664 KB Output is correct
24 Correct 59 ms 528 KB Output is correct
25 Correct 89 ms 532 KB Output is correct
26 Correct 89 ms 344 KB Output is correct
27 Correct 76 ms 344 KB Output is correct
28 Correct 87 ms 348 KB Output is correct
29 Correct 65 ms 532 KB Output is correct
30 Correct 74 ms 532 KB Output is correct
31 Correct 95 ms 344 KB Output is correct
32 Correct 103 ms 540 KB Output is correct
33 Execution timed out 1043 ms 8576 KB Time limit exceeded
34 Halted 0 ms 0 KB -