제출 #839821

#제출 시각아이디문제언어결과실행 시간메모리
839821allin27xA Plus B (IOI23_aplusb)C++17
0 / 100
1087 ms212 KiB
#include <bits/stdc++.h> using namespace std; #define vi vector<int> bool check(int s, vi a, vi b){ int n = a.size(); int prs = 0; int j = n-1; for (int i=0; i<n; i++){ for (; j>=0 && b[j]+a[i]>s; j--) ; prs += j+1; } return prs>=n; } vi smallest_sums(int n, vi a, vi b){ int l = 0, r = 2e9+7; while (l<r){ int m = (l+r)/2; if (check(m, a, b)) r = m; else l = m+1; } vi ans(n,0); int ind = 0; for (int i=0; i<n; i++){ for (int j=0; j<n && a[i]+b[j]<l; j++) ans[ind++] = a[i] + b[j]; } while (ind < n) ans[ind++] = l; sort(ans.begin(), ans.end()); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...