提出 #71009776


ソースコード 拡げる

/*
*            /$$           /$$
*           |__/          |__/
*  /$$$$$$$$ /$$ /$$$$$$$$ /$$  /$$$$$$
* |____ /$$/| $$|____ /$$/| $$ /$$__  $$
*    /$$$$/ | $$   /$$$$/ | $$| $$  \ $$
*   /$$__/  | $$  /$$__/  | $$| $$  | $$
*  /$$$$$$$$| $$ /$$$$$$$$| $$|  $$$$$$$
* |________/|__/|________/|__/ \____  $$
*                                   | $$
*                                   | $$
*                                   |__/
*/
//hj23308±£ÓÓÎÒ
//Missile±£ÓÓÎÒ
/*
* ÐÑÁËÔÚÃÎÀïÕõÔú£¬²»¾õ÷öµ­Á˳¯Ï¼
*/
/*
* ÎҺܸßÐËÄãûÓÐÍüÁËÎÒ£¬µ«ÊÇÎÒÏÖÔÚ¸üÏ£ÍûÄãÒѾ­ÍüÁËÎÒÁË¡£
* Ï£ÍûÔÚÄãµÄ¼ÇÒäÖУ¬ÎÒÖ»Êdz¾ÍÁÒ»´é£¬´ÓÄãµÄÈ«ÊÀ½ç·¹ý£¬È»ºóËÄÉ¢·ÉÑï²»ÁôÏÂÒ»µãºÛ¼££¬¶øÄãÒª²»»ØÍ·µÄÍùǰ×ß¡£
* ÎÒ¸üÏ£ÍûÎÒÖ»ÊÇ´ÓÄãµÄÈ«ÊÀ½ç·¹ý£¬Ö»ÊÇ·¹ý
*/
/*
* Ö»ÊÇÎÒÔÚÊ®×Ö·¿ÚÊØÁËÌ«¾Ã£¬Êص½»ÆÉ³ÈçÓêÑÚÂñÒ»Çкۼ££¬²Å·¢ÏÖ×Ô¼ºµÈµÄÈËÒѾ­À뿪ÁË¡£
*/
/*
* ÌýÎÒµÄ ±ð»ØÍ· »ØÍ·¾Í¿ÉÄÜ»áÀáÁ÷ÂúÃæ£¬»á±»»ÆÉ³ÑÚÂñ£¬ËùÒÔ¼´Ê¹Í´¿àÒ²ÒªÏòǰ×ß
*/
/*
* ÎÒÌýµ½ÁË¡¸ÌìÐн¡¡¹µÄ»ØÏ죬ÕâÊÇÒ»¸öΰ´ó¶·Ê¿µÄ²»Ï¢×ÔÇ¿£»
* ÎÒÌýµ½ÁË¡¸ÆÆÍò·¨¡¹µÄ»ØÏ죬ÕâÊÇÒ»¸öºÚµÀ´òÊÖµÄÊØ»¤ÓûÍû£»
* ÎÒ¿´¼ûÁË¡¸ÉúÉú²»Ï¢¡¹µÄ¼¤µ´£¬ÕâÊÇÒ»¸öÆ­×ÓµÄΰ´óÀÖÕ£¡
*/
/*
* ÎÒÓÃÐé¼ÙµÄÃæ¾ßÕÕ¹Ë×ÅϸÄåµÄ¸ÐÇ飻
* ÎÒÒÔ»ªÀöµÄÒÂÎïϲØ×Ÿ¯ÀõÄѪÈ⣻
* µ±ÎÒÕªÏÂÃæ¾ß£¬ÍÊÈ¥ÒÂÎ¼´±ãÊÇÎÒ×îÇ×½üµÄÈË£¬Ò²ÎÞ·¨Ö±ÊÓÎÒ
*/
#include<bits/stdc++.h>
#define mk make_pair
using namespace std;
mt19937 engine(chrono::steady_clock().now().time_since_epoch().count());
const int MAXN=2e5+5;
int n,q;
long long sum[MAXN],num[MAXN];
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	std::ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>q;
	for(int i=1;i<=n;i++) sum[i]=1;
	for(int i=1;i<=q;i++) {
		int pos,val;
		cin>>pos>>val;
		num[pos]+=val;
		if(pos+1<=n) sum[pos+1]=max(sum[pos+1],num[pos]+1-num[pos+1]);
	}
	long long res=0,Ans=0;
	for(int i=1;i<=n;i++) {
		res+=sum[i];
		Ans+=res;
	}
	cout<<Ans<<"\n";
	return 0;
}

提出情報

提出日時
問題 A - Always Increasing
ユーザ Ziziq
言語 C++23 (GCC 15.2.0)
得点 300
コード長 2565 Byte
結果 AC
実行時間 19 ms
メモリ 6832 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 38
セット名 テストケース
Sample 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt
All 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt, 02_rand_01.txt, 02_rand_02.txt, 02_rand_03.txt, 02_rand_04.txt, 02_rand_05.txt, 02_rand_06.txt, 02_rand_07.txt, 02_rand_08.txt, 02_rand_09.txt, 02_rand_10.txt, 03_maxrand_01.txt, 03_maxrand_02.txt, 03_maxrand_03.txt, 03_maxrand_04.txt, 03_maxrand_05.txt, 03_maxrand_06.txt, 03_maxrand_07.txt, 03_maxrand_08.txt, 03_maxrand_09.txt, 03_maxrand_10.txt, 04_maxrand_skew_01.txt, 04_maxrand_skew_02.txt, 04_maxrand_skew_03.txt, 04_maxrand_skew_04.txt, 04_maxrand_skew_05.txt, 04_maxrand_skew_06.txt, 04_maxrand_skew_07.txt, 04_maxrand_skew_08.txt, 04_maxrand_skew_09.txt, 04_maxrand_skew_10.txt, 05_maxans_01.txt, 05_maxans_02.txt, 05_maxans_03.txt, 05_maxans_04.txt, 05_maxans_05.txt
ケース名 結果 実行時間 メモリ
01_sample_01.txt AC 1 ms 3532 KiB
01_sample_02.txt AC 1 ms 3572 KiB
01_sample_03.txt AC 1 ms 4468 KiB
02_rand_01.txt AC 1 ms 4316 KiB
02_rand_02.txt AC 7 ms 5312 KiB
02_rand_03.txt AC 7 ms 4812 KiB
02_rand_04.txt AC 10 ms 5540 KiB
02_rand_05.txt AC 12 ms 6168 KiB
02_rand_06.txt AC 11 ms 3700 KiB
02_rand_07.txt AC 10 ms 3548 KiB
02_rand_08.txt AC 10 ms 3620 KiB
02_rand_09.txt AC 10 ms 3776 KiB
02_rand_10.txt AC 14 ms 5216 KiB
03_maxrand_01.txt AC 19 ms 6708 KiB
03_maxrand_02.txt AC 17 ms 6748 KiB
03_maxrand_03.txt AC 17 ms 6772 KiB
03_maxrand_04.txt AC 18 ms 6772 KiB
03_maxrand_05.txt AC 17 ms 6752 KiB
03_maxrand_06.txt AC 17 ms 6780 KiB
03_maxrand_07.txt AC 18 ms 6732 KiB
03_maxrand_08.txt AC 17 ms 6748 KiB
03_maxrand_09.txt AC 17 ms 6748 KiB
03_maxrand_10.txt AC 17 ms 6748 KiB
04_maxrand_skew_01.txt AC 12 ms 5244 KiB
04_maxrand_skew_02.txt AC 12 ms 5240 KiB
04_maxrand_skew_03.txt AC 13 ms 5240 KiB
04_maxrand_skew_04.txt AC 13 ms 5500 KiB
04_maxrand_skew_05.txt AC 14 ms 6580 KiB
04_maxrand_skew_06.txt AC 12 ms 5312 KiB
04_maxrand_skew_07.txt AC 11 ms 5240 KiB
04_maxrand_skew_08.txt AC 13 ms 5164 KiB
04_maxrand_skew_09.txt AC 13 ms 5408 KiB
04_maxrand_skew_10.txt AC 14 ms 6644 KiB
05_maxans_01.txt AC 11 ms 6752 KiB
05_maxans_02.txt AC 11 ms 6832 KiB
05_maxans_03.txt AC 11 ms 6772 KiB
05_maxans_04.txt AC 11 ms 6772 KiB
05_maxans_05.txt AC 11 ms 6716 KiB