# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1092063 | vjudge1 | A Plus B (IOI23_aplusb) | C++17 | 1089 ms | 348 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<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define pb push_back
#define re exit(0);
#define left id<<1
#define right id<<1|1
const int mod = 1e9+7;
const int INF = 1e9;
typedef vector<int> vi ;
typedef pair<int,int> pii ;
typedef vector<pii> vii ;
void add ( int &a , int b ) { if ( a += b >= mod) a -= mod; }
void sub ( int &a , int b ) { if ( a -= b <= mod ) a += mod; }
template < typename T > void chkmin ( T &a , T b ) { if ( a > b ) a = b ; }
template < typename T > void chkmax ( T &a , T b ) { if ( a < b ) a = b ; }
void runfile() { freopen ("inp.txt","r",stdin) ; }
vi smallest_sums ( int N , vi A , vi B )
{
int l = 0 , r = 2e9 , res ;
while ( l <= r )
{
int mid = (l+r)/2 ;
int j = N-1 ;
ll total = 0 ;
for ( int i = 0 ; i < N ; i ++ )
{
if ( A[i] + B[j] > mid && j >= 1 ) j -- ;
if ( A[i] + B[j] <= mid ) total += j+1 ;
}
if ( total >= N ) r = mid-1 , res = mid ;
else l = mid+1 ;
}
vi answer ;
for ( int i = 0 ; i < N ; i ++ )
{
for ( int j = 0 ; j < N ; j ++ )
{
if ( A[i] + B[j] <= res ) answer . pb (A[i]+B[j]) ;
else break ;
}
}
sort(answer.begin(),answer.end()) ;
while (answer.size() > N ) answer.pop_back() ;
return answer ;
}
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... |