# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
243126 | 2020-06-30T11:42:18 Z | socho | Just Long Neckties (JOI20_ho_t1) | C++14 | 375 ms | 18808 KB |
#include "bits/stdc++.h" using namespace std; void fast() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); } void ran() { srand(chrono::steady_clock::now().time_since_epoch().count()); } long long get_rand() { long long a = rand(); long long b = rand(); return a * (RAND_MAX + 1ll) + b; } // #define endl '\n' // #define double long double // #define int long long // int MOD = 1000 * 1000 * 1000 + 7; // int MOD = 998244353; signed main() { ran(); fast(); int n; cin >> n; pair<int, int> ops[n+1]; for (int i=0; i<n+1; i++) { cin >> ops[i].first; ops[i].second = i; } int arr[n]; for (int i=0; i<n; i++) { cin >> arr[i]; } sort(arr, arr+n); sort(ops, ops+n+1); multiset<int> dfs; for (int i=1; i<n+1; i++) { dfs.insert(max(ops[i].first - arr[i-1], 0)); } int ans[n+1]; // cout << ops[0].second << endl; ans[ops[0].second] = *(--dfs.end()); for (int i=1; i<n+1; i++) { dfs.erase(dfs.find(max(ops[i].first - arr[i-1], 0))); dfs.insert(max(ops[i-1].first - arr[i-1], 0)); ans[ops[i].second] = *(--dfs.end()); // cout << ops[i].second << endl; } for (int i=0; i<n+1; i++) { cout << ans[i] << ' '; } cout << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
13 | Correct | 5 ms | 384 KB | Output is correct |
14 | Correct | 6 ms | 384 KB | Output is correct |
15 | Correct | 6 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 512 KB | Output is correct |
18 | Correct | 6 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 384 KB | Output is correct |
20 | Correct | 6 ms | 384 KB | Output is correct |
21 | Correct | 6 ms | 384 KB | Output is correct |
22 | Correct | 6 ms | 512 KB | Output is correct |
23 | Correct | 6 ms | 384 KB | Output is correct |
24 | Correct | 7 ms | 384 KB | Output is correct |
25 | Correct | 6 ms | 512 KB | Output is correct |
26 | Correct | 6 ms | 512 KB | Output is correct |
27 | Correct | 6 ms | 512 KB | Output is correct |
28 | Correct | 6 ms | 512 KB | Output is correct |
29 | Correct | 6 ms | 384 KB | Output is correct |
30 | Correct | 6 ms | 512 KB | Output is correct |
31 | Correct | 6 ms | 512 KB | Output is correct |
32 | Correct | 6 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
13 | Correct | 5 ms | 384 KB | Output is correct |
14 | Correct | 6 ms | 384 KB | Output is correct |
15 | Correct | 6 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 512 KB | Output is correct |
18 | Correct | 6 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 384 KB | Output is correct |
20 | Correct | 6 ms | 384 KB | Output is correct |
21 | Correct | 6 ms | 384 KB | Output is correct |
22 | Correct | 6 ms | 512 KB | Output is correct |
23 | Correct | 6 ms | 384 KB | Output is correct |
24 | Correct | 7 ms | 384 KB | Output is correct |
25 | Correct | 6 ms | 512 KB | Output is correct |
26 | Correct | 6 ms | 512 KB | Output is correct |
27 | Correct | 6 ms | 512 KB | Output is correct |
28 | Correct | 6 ms | 512 KB | Output is correct |
29 | Correct | 6 ms | 384 KB | Output is correct |
30 | Correct | 6 ms | 512 KB | Output is correct |
31 | Correct | 6 ms | 512 KB | Output is correct |
32 | Correct | 6 ms | 512 KB | Output is correct |
33 | Correct | 227 ms | 13796 KB | Output is correct |
34 | Correct | 266 ms | 18168 KB | Output is correct |
35 | Correct | 231 ms | 17632 KB | Output is correct |
36 | Correct | 268 ms | 18164 KB | Output is correct |
37 | Correct | 281 ms | 18808 KB | Output is correct |
38 | Correct | 240 ms | 18424 KB | Output is correct |
39 | Correct | 353 ms | 17472 KB | Output is correct |
40 | Correct | 327 ms | 17376 KB | Output is correct |
41 | Correct | 375 ms | 17656 KB | Output is correct |
42 | Correct | 361 ms | 17528 KB | Output is correct |
43 | Correct | 362 ms | 17576 KB | Output is correct |
44 | Correct | 192 ms | 16916 KB | Output is correct |
45 | Correct | 223 ms | 17016 KB | Output is correct |
46 | Correct | 188 ms | 16888 KB | Output is correct |
47 | Correct | 202 ms | 17332 KB | Output is correct |
48 | Correct | 197 ms | 17608 KB | Output is correct |
49 | Correct | 362 ms | 18040 KB | Output is correct |
50 | Correct | 360 ms | 17912 KB | Output is correct |
51 | Correct | 314 ms | 17912 KB | Output is correct |
52 | Correct | 366 ms | 17860 KB | Output is correct |
53 | Correct | 374 ms | 17912 KB | Output is correct |