제출 #413568

#제출 시각아이디문제언어결과실행 시간메모리
413568OzyJust Long Neckties (JOI20_ho_t1)C++17
0 / 100
1 ms388 KiB
#include <iostream> #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for (int i = (a); i <= (b); i++) #define repa(i,a,b) for (int i = (a); i >= (b); i--) #define lli long long int #define debugsl(a) cout << #a << " = " << a << ", " #define debug(a) cout << #a << " = " << a << endl #define MAX 200000 lli n,res,paso,a; lli ori[MAX+2],A[MAX+2],B[MAX+2]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; rep(i,1,n+1) { cin >> A[i]; ori[i] = A[i]; } rep(i,1,n) cin >> B[i]; sort(A+1, A+n+2); sort(B+1, B+n+1); rep(i,1,n+1) { paso = 0; res = 0; rep(j,1,n) { if (paso==0 && ori[i] == A[j]) { paso=1; continue; } a = A[j] - B[j-paso]; if (a > res) res = a; } cout << res << ' '; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...