結果

問題 No.1194 Replace
ユーザー tailstails
提出日時 2020-09-14 18:50:26
言語 cLay
(20240104-1)
結果
AC  
実行時間 612 ms / 2,000 ms
コード長 220 bytes
コンパイル時間 4,157 ms
コンパイル使用メモリ 175,148 KB
実行使用メモリ 38,896 KB
最終ジャッジ日時 2023-09-19 01:14:01
合計ジャッジ時間 13,153 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 373 ms
28,772 KB
testcase_01 AC 427 ms
30,528 KB
testcase_02 AC 316 ms
25,340 KB
testcase_03 AC 255 ms
21,992 KB
testcase_04 AC 437 ms
30,528 KB
testcase_05 AC 394 ms
28,528 KB
testcase_06 AC 361 ms
26,872 KB
testcase_07 AC 594 ms
38,676 KB
testcase_08 AC 597 ms
38,832 KB
testcase_09 AC 603 ms
38,836 KB
testcase_10 AC 612 ms
38,896 KB
testcase_11 AC 603 ms
38,788 KB
testcase_12 AC 600 ms
38,844 KB
testcase_13 AC 448 ms
25,172 KB
testcase_14 AC 379 ms
22,340 KB
testcase_15 AC 273 ms
19,896 KB
testcase_16 AC 409 ms
24,672 KB
testcase_17 AC 254 ms
18,796 KB
testcase_18 AC 275 ms
18,992 KB
testcase_19 AC 421 ms
24,624 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,384 KB
testcase_22 AC 2 ms
4,384 KB
testcase_23 AC 86 ms
10,952 KB
testcase_24 AC 19 ms
6,140 KB
testcase_25 AC 9 ms
4,412 KB
testcase_26 AC 125 ms
12,328 KB
testcase_27 AC 14 ms
4,920 KB
testcase_28 AC 46 ms
7,696 KB
testcase_29 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void f(int i){
	for(auto j:g[-i])
	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