Submission #68744842


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3fLL;
const int MAX=2e5+10;
int a[MAX],b[MAX];
int main()
{
	int n,q,i,x,v;
	ll ans;
	char op[2];
	scanf("%d%d",&n,&q);
	for(i=1;i<=n;i++) scanf("%d",&a[i]);
	for(i=1;i<=n;i++) scanf("%d",&b[i]);
	ans=0;
	for(i=1;i<=n;i++) ans+=min(a[i],b[i]);
	while(q--)
	{
		scanf("%s%d%d",op,&x,&v);
		ans-=min(a[x],b[x]);
		if(op[0]=='A') a[x]=v;
		else b[x]=v;
		ans+=min(a[x],b[x]);
		printf("%lld\n",ans);
	}
	return 0;
}

Submission Info

Submission Time
Task C - Sum of Min Query
User tokitsukaze
Language C++ 20 (gcc 12.2)
Score 300
Code Size 565 Byte
Status AC
Exec Time 101 ms
Memory 5456 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%d%d",&n,&q);
      |         ~~~~~^~~~~~~~~~~~~~
Main.cpp:14:32: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         for(i=1;i<=n;i++) scanf("%d",&a[i]);
      |                           ~~~~~^~~~~~~~~~~~
Main.cpp:15:32: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         for(i=1;i<=n;i++) scanf("%d",&b[i]);
      |                           ~~~~~^~~~~~~~~~~~
Main.cpp:20:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |                 scanf("%s%d%d",op,&x,&v);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 23
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 3696 KiB
00_sample_01.txt AC 1 ms 3784 KiB
00_sample_02.txt AC 1 ms 3852 KiB
01_random_00.txt AC 1 ms 3576 KiB
01_random_01.txt AC 80 ms 5408 KiB
01_random_02.txt AC 80 ms 5140 KiB
01_random_03.txt AC 47 ms 4464 KiB
01_random_04.txt AC 94 ms 5088 KiB
01_random_05.txt AC 45 ms 4772 KiB
01_random_06.txt AC 74 ms 4584 KiB
01_random_07.txt AC 27 ms 4564 KiB
01_random_08.txt AC 99 ms 5220 KiB
01_random_09.txt AC 95 ms 5456 KiB
01_random_10.txt AC 99 ms 5252 KiB
01_random_11.txt AC 90 ms 5416 KiB
01_random_12.txt AC 99 ms 5216 KiB
01_random_13.txt AC 99 ms 5412 KiB
01_random_14.txt AC 99 ms 5216 KiB
01_random_15.txt AC 100 ms 5360 KiB
01_random_16.txt AC 101 ms 5216 KiB
01_random_17.txt AC 100 ms 5140 KiB
01_random_18.txt AC 94 ms 5224 KiB
01_random_19.txt AC 99 ms 5412 KiB