結果

問題 No.1194 Replace
ユーザー tailstails
提出日時 2020-09-14 18:42:11
言語 cLay
(20240104-1)
結果
AC  
実行時間 661 ms / 2,000 ms
コード長 231 bytes
コンパイル時間 2,228 ms
コンパイル使用メモリ 175,336 KB
実行使用メモリ 38,860 KB
最終ジャッジ日時 2023-09-19 01:10:49
合計ジャッジ時間 17,809 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 424 ms
28,012 KB
testcase_01 AC 477 ms
29,584 KB
testcase_02 AC 347 ms
24,868 KB
testcase_03 AC 272 ms
21,692 KB
testcase_04 AC 470 ms
29,504 KB
testcase_05 AC 431 ms
27,964 KB
testcase_06 AC 395 ms
26,136 KB
testcase_07 AC 648 ms
38,792 KB
testcase_08 AC 661 ms
38,752 KB
testcase_09 AC 643 ms
38,748 KB
testcase_10 AC 638 ms
38,808 KB
testcase_11 AC 650 ms
38,728 KB
testcase_12 AC 649 ms
38,860 KB
testcase_13 AC 459 ms
22,636 KB
testcase_14 AC 389 ms
19,804 KB
testcase_15 AC 293 ms
18,656 KB
testcase_16 AC 446 ms
22,240 KB
testcase_17 AC 267 ms
17,508 KB
testcase_18 AC 280 ms
17,100 KB
testcase_19 AC 433 ms
22,484 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 84 ms
10,348 KB
testcase_24 AC 20 ms
6,124 KB
testcase_25 AC 10 ms
4,380 KB
testcase_26 AC 121 ms
11,168 KB
testcase_27 AC 14 ms
4,476 KB
testcase_28 AC 44 ms
7,164 KB
testcase_29 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

map<int,vector<int>>g;
map<int,int>v;
ll n,m,b,c,w,z;

void f(int i){
	REP[g[-i]](j,g[-i].size())
	if(j<w&&!v[j]++)z+=w-j,f(j);
}

{
	rd(n,m);
	rep(m)rd(b,c),g[-c].push_back(b);
	z=n*(n+1)/2;
	for(auto t:g)f(w=-t.first);
	wt(z);
}
0