Submission #208979

# Submission time Handle Problem Language Result Execution time Memory
208979 2020-03-12T20:08:36 Z davitmarg Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
5 ms 380 KB
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(), v.end()
using namespace std;

const int N = 200005;

LL n, a[N], b[N], sf[N], pr[N];

int main()
{
	cin >> n;
	for (int i = 1; i <= n + 1; i++)
		scanf("%lld", a + i);
	for (int i = 1; i <= n; i++)
		scanf("%lld", b + i);
	sort(a + 1, a + 1 + n + 1);
	sort(b + 1, b + 1 + n);

	for (int i = 1; i <= n; i++)
		pr[i] = max(pr[i - 1], a[i] - b[i]);

	for (int i = n; i >= 1; i--)
		sf[i] = max(sf[i + 1], a[i + 1] - b[i]);

	for (int i = 0; i <= n; i++)
		cout << max(pr[i], sf[i + 1]) << " ";
	cout << endl;
	return 0;
}

/*



*/

Compilation message

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:34:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", a + i);
   ~~~~~^~~~~~~~~~~~~~~
ho_t1.cpp:36:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", b + i);
   ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 380 KB Output isn't correct
2 Halted 0 ms 0 KB -