Submission #63520477
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef pair<ll,ll> pi;
typedef pair<ll,pi> ppi;
typedef pair<ll,ppi> pppi;
typedef pair<ll,pppi> ppppi;
#define FOR(i,l,r) for(ll i=l;i<r;i++)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,l,r) for(ll i=r-1;i>=l;i--)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define F first
#define S second
#define BS(A,x) binary_search(ALL(A),x)
#define LB(A,x) (ll)(lower_bound(ALL(A),x)-A.begin())
#define UB(A,x) (ll)(upper_bound(ALL(A),x)-A.begin())
#define COU(A,x) (UB(A,x)-LB(A,x))
#define sz(c) ((ll)(c).size())
/*
#include<boost/multiprecision/cpp_int.hpp>
namespace mp=boost::multiprecision;
using Bint=mp::cpp_int;
*/
template<typename T>using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<typename T1,typename T2>ostream&operator<<(ostream&os,pair<T1,T2>p){os<<p.F<<" "<<p.S;return os;}
template<typename T1,typename T2>istream&operator>>(istream&is,pair<T1,T2>&p){is>>p.F>>p.S;return is;}
template<typename T>ostream&operator<<(ostream&os,vector<T>v){REP(i,sz(v))os<<v[i]<<(i+1!=sz(v)?" ":"");return os;}
template<typename T>istream&operator>>(istream&is,vector<T>&v){for(T&in:v)is>>in;return is;}
template<class T>bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,T b){if(b<a){a=b;return 1;}return 0;}
ld dist(ld x1,ld y1,ld x2,ld y2){return sqrtl((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
const ld EPS=1e-8;
//*
using mint=modint998244353;
const ll mod=998244353;
//*/
/*
using mint=modint1000000007;
const ll mod=1000000007;
//*/
//using mint=modint;
//*
typedef vector<mint> vm;
typedef vector<vm> vvm;
typedef vector<vvm> vvvm;
typedef vector<vvvm> vvvvm;
ostream&operator<<(ostream&os,mint a){os<<a.val();return os;}
istream&operator>>(istream&is,mint&a){int x;is>>x;a=mint(x);return is;}
//*/
int main(){
ll N,M;cin>>N>>M;
vi A(N),B(M);cin>>A>>B;
sort(ALL(A));
sort(ALL(B));
reverse(ALL(A));
reverse(ALL(B));
vi C(N+1),D(M+1);
REP(i,N)C[i+1]=A[i]+C[i];
REP(i,M)D[i+1]=B[i]+D[i];
auto E=C;
RREP(i,N)chmax(E[i],E[i+1]);
ll ans=0;
REP(i,M+1)if(N>=i){
chmax(ans,D[i]+E[i]);
}
cout<<ans<<endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Buy Balls |
User |
TKTYI |
Language |
C++ 23 (gcc 12.2) |
Score |
300 |
Code Size |
2536 Byte |
Status |
AC |
Exec Time |
135 ms |
Memory |
11156 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
Set Name |
Test Cases |
Sample |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt, 01_test_32.txt, 01_test_33.txt, 01_test_34.txt, 01_test_35.txt, 01_test_36.txt, 01_test_37.txt, 01_test_38.txt, 01_test_39.txt, 01_test_40.txt, 01_test_41.txt, 01_test_42.txt, 01_test_43.txt, 01_test_44.txt, 01_test_45.txt |
Case Name |
Status |
Exec Time |
Memory |
00_sample_00.txt |
AC |
1 ms |
3468 KB |
00_sample_01.txt |
AC |
1 ms |
3676 KB |
00_sample_02.txt |
AC |
1 ms |
3524 KB |
01_test_00.txt |
AC |
1 ms |
3504 KB |
01_test_01.txt |
AC |
1 ms |
3556 KB |
01_test_02.txt |
AC |
1 ms |
3416 KB |
01_test_03.txt |
AC |
67 ms |
7144 KB |
01_test_04.txt |
AC |
46 ms |
6380 KB |
01_test_05.txt |
AC |
41 ms |
5824 KB |
01_test_06.txt |
AC |
131 ms |
11088 KB |
01_test_07.txt |
AC |
135 ms |
11024 KB |
01_test_08.txt |
AC |
130 ms |
11136 KB |
01_test_09.txt |
AC |
131 ms |
11112 KB |
01_test_10.txt |
AC |
132 ms |
11152 KB |
01_test_11.txt |
AC |
131 ms |
11100 KB |
01_test_12.txt |
AC |
130 ms |
11088 KB |
01_test_13.txt |
AC |
132 ms |
11072 KB |
01_test_14.txt |
AC |
131 ms |
11000 KB |
01_test_15.txt |
AC |
116 ms |
9816 KB |
01_test_16.txt |
AC |
130 ms |
10904 KB |
01_test_17.txt |
AC |
110 ms |
9504 KB |
01_test_18.txt |
AC |
130 ms |
11120 KB |
01_test_19.txt |
AC |
133 ms |
10012 KB |
01_test_20.txt |
AC |
129 ms |
11156 KB |
01_test_21.txt |
AC |
115 ms |
9780 KB |
01_test_22.txt |
AC |
130 ms |
11108 KB |
01_test_23.txt |
AC |
106 ms |
9024 KB |
01_test_24.txt |
AC |
131 ms |
11116 KB |
01_test_25.txt |
AC |
102 ms |
9248 KB |
01_test_26.txt |
AC |
130 ms |
10912 KB |
01_test_27.txt |
AC |
111 ms |
10048 KB |
01_test_28.txt |
AC |
128 ms |
11000 KB |
01_test_29.txt |
AC |
110 ms |
9584 KB |
01_test_30.txt |
AC |
132 ms |
11064 KB |
01_test_31.txt |
AC |
92 ms |
8908 KB |
01_test_32.txt |
AC |
127 ms |
11120 KB |
01_test_33.txt |
AC |
101 ms |
9236 KB |
01_test_34.txt |
AC |
123 ms |
11120 KB |
01_test_35.txt |
AC |
106 ms |
9792 KB |
01_test_36.txt |
AC |
129 ms |
11036 KB |
01_test_37.txt |
AC |
86 ms |
8196 KB |
01_test_38.txt |
AC |
130 ms |
10996 KB |
01_test_39.txt |
AC |
97 ms |
8920 KB |
01_test_40.txt |
AC |
129 ms |
11048 KB |
01_test_41.txt |
AC |
95 ms |
8444 KB |
01_test_42.txt |
AC |
133 ms |
11052 KB |
01_test_43.txt |
AC |
1 ms |
3408 KB |
01_test_44.txt |
AC |
70 ms |
6364 KB |
01_test_45.txt |
AC |
67 ms |
7740 KB |