Submission #68764617
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=(1e6)+10;
int n,q;
int a[maxn],b[maxn];
ll ans;
void add(int x,int y) {
ans+=min(a[x],b[x])*y;
}
int main() {
scanf("%d %d",&n,&q);
for (int i=1;i<=n;i++) scanf("%d",&a[i]);
for (int i=1;i<=n;i++) scanf("%d",&b[i]),add(i,1);
while (q--) {
int x; char s[5];
scanf("%s %d",s,&x);
add(x,-1);
if (s[0]=='A') scanf("%d",&a[x]);
else scanf("%d",&b[x]);
add(x,1);
printf("%lld\n",ans);
}
return 0;
}
Submission Info
Submission Time
2025-08-24 21:46:54+0900
Task
C - Sum of Min Query
User
wygz
Language
C++ 20 (gcc 12.2)
Score
300
Code Size
583 Byte
Status
AC
Exec Time
107 ms
Memory
5488 KiB
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d %d",&n,&q);
| ~~~~~^~~~~~~~~~~~~~~
Main.cpp:13:33: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | for (int i=1;i<=n;i++) scanf("%d",&a[i]);
| ~~~~~^~~~~~~~~~~~
Main.cpp:14:33: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | for (int i=1;i<=n;i++) scanf("%d",&b[i]),add(i,1);
| ~~~~~^~~~~~~~~~~~
Main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%s %d",s,&x);
| ~~~~~^~~~~~~~~~~~~~
Main.cpp:19:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
19 | if (s[0]=='A') scanf("%d",&a[x]);
| ~~~~~^~~~~~~~~~~~
Main.cpp:20:19: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
20 | else scanf("%d",&b[x]);
| ~~~~~^~~~~~~~~~~~
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_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt
Case Name
Status
Exec Time
Memory
00_sample_00.txt
AC
1 ms
3664 KiB
00_sample_01.txt
AC
1 ms
3864 KiB
00_sample_02.txt
AC
1 ms
3680 KiB
01_random_00.txt
AC
1 ms
3696 KiB
01_random_01.txt
AC
88 ms
5348 KiB
01_random_02.txt
AC
89 ms
5420 KiB
01_random_03.txt
AC
49 ms
4472 KiB
01_random_04.txt
AC
100 ms
5104 KiB
01_random_05.txt
AC
47 ms
4668 KiB
01_random_06.txt
AC
79 ms
4480 KiB
01_random_07.txt
AC
29 ms
4588 KiB
01_random_08.txt
AC
106 ms
5352 KiB
01_random_09.txt
AC
101 ms
5276 KiB
01_random_10.txt
AC
107 ms
5240 KiB
01_random_11.txt
AC
95 ms
5348 KiB
01_random_12.txt
AC
106 ms
5344 KiB
01_random_13.txt
AC
104 ms
5468 KiB
01_random_14.txt
AC
107 ms
5416 KiB
01_random_15.txt
AC
106 ms
5488 KiB
01_random_16.txt
AC
105 ms
5420 KiB
01_random_17.txt
AC
105 ms
5228 KiB
01_random_18.txt
AC
100 ms
5168 KiB
01_random_19.txt
AC
107 ms
5252 KiB