답안 #203059

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
203059 2020-02-19T07:03:33 Z _7_7_ Just Long Neckties (JOI20_ho_t1) C++14
0 / 100
5 ms 248 KB
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 2e5 + 11;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;

int a[N], b[N], n, pref[N], suff[N];


main () {
	cin >> n;
	forn (i, 1, n + 1)
		cin >> a[i];

	forn (i, 1, n)
		cin >> b[i];

	sort(a + 1, a + 2 + n);
	sort(b + 1, b + 1 + n);
	forn (i, 1, n)
		pref[i] = max(pref[i - 1], a[i] - b[i]);

	forev (i, n, 1) 
		suff[i] = max(suff[i + 1], a[i + 1] - b[i]);

	forn (i, 1, n + 1)
		cout << max(pref[i - 1], suff[i]) << ' ';	
	return 0;			
}

Compilation message

ho_t1.cpp:43:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -