Submission #63539253
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>
using namespace std;
int main(){
int i,j,Q,A[105],seq,ans,qa,qb,N,M,numb,sum,b,w;
long long sumb;
priority_queue<int> W;
priority_queue<int> B;
cin>>N>>M;
numb=0;
sumb=0;
for(i=0;i<N;i++){
cin>>b;
B.push(b);
}
for(i=0;i<M;i++){
cin>>w;
W.push(w);
}
int bsize=B.size();
for(i=0;i<bsize;i++){
w=-1;
if(!W.empty()){
w=W.top();W.pop();
}
b=B.top();B.pop();
sum=w+b;
if(b>0){
sumb+=b;
if(w>0){
sumb+=w;
}
}else if(sum>=0){
sumb+=sum;
}
}
cout<<sumb;
return 0;
}
Submission Info
Submission Time |
|
Task |
C - Buy Balls |
User |
taroki |
Language |
C++ 17 (gcc 12.2) |
Score |
300 |
Code Size |
655 Byte |
Status |
AC |
Exec Time |
149 ms |
Memory |
5696 KB |
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:4:9: warning: unused variable ‘j’ [-Wunused-variable]
4 | int i,j,Q,A[105],seq,ans,qa,qb,N,M,numb,sum,b,w;
| ^
Main.cpp:4:11: warning: unused variable ‘Q’ [-Wunused-variable]
4 | int i,j,Q,A[105],seq,ans,qa,qb,N,M,numb,sum,b,w;
| ^
Main.cpp:4:13: warning: unused variable ‘A’ [-Wunused-variable]
4 | int i,j,Q,A[105],seq,ans,qa,qb,N,M,numb,sum,b,w;
| ^
Main.cpp:4:20: warning: unused variable ‘seq’ [-Wunused-variable]
4 | int i,j,Q,A[105],seq,ans,qa,qb,N,M,numb,sum,b,w;
| ^~~
Main.cpp:4:24: warning: unused variable ‘ans’ [-Wunused-variable]
4 | int i,j,Q,A[105],seq,ans,qa,qb,N,M,numb,sum,b,w;
| ^~~
Main.cpp:4:28: warning: unused variable ‘qa’ [-Wunused-variable]
4 | int i,j,Q,A[105],seq,ans,qa,qb,N,M,numb,sum,b,w;
| ^~
Main.cpp:4:31: warning: unused variable ‘qb’ [-Wunused-variable]
4 | int i,j,Q,A[105],seq,ans,qa,qb,N,M,numb,sum,b,w;
| ^~
Main.cpp:4:38: warning: variable ‘numb’ set but not used [-Wunused-but-set-variable]
4 | int i,j,Q,A[105],seq,ans,qa,qb,N,M,numb,sum,b,w;
| ^~~~
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 |
3492 KB |
00_sample_01.txt |
AC |
1 ms |
3452 KB |
00_sample_02.txt |
AC |
1 ms |
3536 KB |
01_test_00.txt |
AC |
1 ms |
3692 KB |
01_test_01.txt |
AC |
1 ms |
3644 KB |
01_test_02.txt |
AC |
1 ms |
3488 KB |
01_test_03.txt |
AC |
74 ms |
4208 KB |
01_test_04.txt |
AC |
51 ms |
3900 KB |
01_test_05.txt |
AC |
45 ms |
3900 KB |
01_test_06.txt |
AC |
149 ms |
5452 KB |
01_test_07.txt |
AC |
147 ms |
5440 KB |
01_test_08.txt |
AC |
147 ms |
5508 KB |
01_test_09.txt |
AC |
149 ms |
5452 KB |
01_test_10.txt |
AC |
148 ms |
5520 KB |
01_test_11.txt |
AC |
147 ms |
5460 KB |
01_test_12.txt |
AC |
147 ms |
5428 KB |
01_test_13.txt |
AC |
147 ms |
5552 KB |
01_test_14.txt |
AC |
148 ms |
5520 KB |
01_test_15.txt |
AC |
126 ms |
5196 KB |
01_test_16.txt |
AC |
147 ms |
5516 KB |
01_test_17.txt |
AC |
120 ms |
5224 KB |
01_test_18.txt |
AC |
147 ms |
5480 KB |
01_test_19.txt |
AC |
131 ms |
5192 KB |
01_test_20.txt |
AC |
146 ms |
5604 KB |
01_test_21.txt |
AC |
124 ms |
5260 KB |
01_test_22.txt |
AC |
147 ms |
5520 KB |
01_test_23.txt |
AC |
111 ms |
4644 KB |
01_test_24.txt |
AC |
148 ms |
5532 KB |
01_test_25.txt |
AC |
114 ms |
5172 KB |
01_test_26.txt |
AC |
149 ms |
5696 KB |
01_test_27.txt |
AC |
127 ms |
5460 KB |
01_test_28.txt |
AC |
144 ms |
5532 KB |
01_test_29.txt |
AC |
124 ms |
5268 KB |
01_test_30.txt |
AC |
149 ms |
5516 KB |
01_test_31.txt |
AC |
104 ms |
5244 KB |
01_test_32.txt |
AC |
146 ms |
5460 KB |
01_test_33.txt |
AC |
107 ms |
4660 KB |
01_test_34.txt |
AC |
140 ms |
5692 KB |
01_test_35.txt |
AC |
121 ms |
5428 KB |
01_test_36.txt |
AC |
145 ms |
5516 KB |
01_test_37.txt |
AC |
94 ms |
4744 KB |
01_test_38.txt |
AC |
149 ms |
5536 KB |
01_test_39.txt |
AC |
106 ms |
5252 KB |
01_test_40.txt |
AC |
146 ms |
5516 KB |
01_test_41.txt |
AC |
99 ms |
4564 KB |
01_test_42.txt |
AC |
149 ms |
5460 KB |
01_test_43.txt |
AC |
1 ms |
3448 KB |
01_test_44.txt |
AC |
56 ms |
4296 KB |
01_test_45.txt |
AC |
75 ms |
4148 KB |