제출 #833050

#제출 시각아이디문제언어결과실행 시간메모리
833050jaeJust Long Neckties (JOI20_ho_t1)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using vi = std::vector<int>; using pi = std::pair<int, int>; #define REP(i,a,b) for(int i{ a }; i < b; ++i) #define MP std::make_pair #define PB push_back #define ALL(x) (x).begin(), (x).end() #define RALL(x) (x).rbegin(), (x).rend() void solve(int no) { int n{}; cin >> n; vi a(n + 1); REP(i, 0, n + 1) cin >> a[i]; vi b(n); REP(i, 0, n) cin >> b[i]; sort(ALL(a)); sort(ALL(b)); for(int i{ 0 }; i < n + 1; ++i) { ll oddity{ 0 }; for(int j{ 0 }, k{ 0 }; k < n; ++j) { if(i == j) continue; oddity = max(oddity, ll(max(0, a[j] - b[k]))); ++k; } cout << oddity << ' '; } cout << '\n'; } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); solve(0); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...