# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
227614 | 2020-04-28T06:35:28 Z | Rakhmand | Just Long Neckties (JOI20_ho_t1) | C++14 | 5 ms | 384 KB |
// I feel still alive. // Created by existence on 18/04/2003. // Copyright © 2020 Rakhman. All rights reserved. #include <cstring> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <queue> #include <random> #include <cmath> #include <cstdlib> #include <ctime> #include <cassert> #include <iterator> #define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0); #define S second #define F first #define y1 asdsaaa #define nl '\n' const long long mxn = 2e5 + 10; const long long mod = 1e9 + 7; const long long inf = 1e18; typedef long long llong; using namespace std; void istxt(bool yes){ if(yes == 1){ freopen("balancing.in", "r", stdin); freopen("balancing.out", "w", stdout); }else{ freopen("/Users/rakhmanabdirashov/Desktop/folder/Programming/Road2Master/Road2Master/input.txt", "r", stdin); } } int n, a[mxn], b[mxn], su[mxn]; int main () { ios; //istxt(0); cin >> n; for(int i = 1; i <= n + 1; i++){ cin >> a[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 = n; i >= 1; i--){ su[i] = max(su[i + 1], max(0, a[i + 1] - b[i])); } int pr = 0; for(int i = 1; i <= n + 1; i++){ cout << max(su[i], pr) << ' '; pr = max(pr, max(0, a[i] - b[i])); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |