# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1092066 | 2024-09-23T04:05:36 Z | thunopro | A Plus B (IOI23_aplusb) | C++17 | 1000 ms | 348 KB |
#include<bits/stdc++.h> #include "aplusb.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 ++ ) { while ( 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Execution timed out | 1087 ms | 348 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Execution timed out | 1087 ms | 348 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Execution timed out | 1087 ms | 348 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Execution timed out | 1087 ms | 348 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |