# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
939828 | AdamGS | A Plus B (IOI23_aplusb) | C++17 | 40 ms | 6164 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "aplusb.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e5+7;
ll A[LIM], B[LIM], n;
bool check(ll x) {
ll ile=0;
rep(i, n) {
rep(j, n) {
if(A[i]+B[j]>x) break;
++ile;
if(ile>n) return false;
}
}
return true;
}
vector<int>smallest_sums(int _N, vector<int>_A, vector<int>_B) {
n=_N;
rep(i, n) A[i]=_A[i];
rep(i, n) B[i]=_B[i];
ll po=0, ko=A[n-1]+B[n-1];
while(po<ko) {
ll sr=(po+ko+1)/2;
if(check(sr)) po=sr; else ko=sr-1;
}
vector<int>ans;
rep(i, n) {
rep(j, n) {
if(A[i]+B[j]>po) break;
ans.pb(A[i]+B[j]);
}
}
while(ans.size()<n) ans.pb(po+1);
sort(all(ans));
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |