結果

問題 No.1708 Quality of Contest
ユーザー kotatsugamekotatsugame
提出日時 2021-10-18 23:16:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 584 bytes
コンパイル時間 802 ms
コンパイル使用メモリ 81,932 KB
実行使用メモリ 6,532 KB
最終ジャッジ日時 2023-10-20 00:06:37
合計ジャッジ時間 7,896 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 5 ms
4,348 KB
testcase_04 AC 6 ms
4,348 KB
testcase_05 AC 6 ms
4,348 KB
testcase_06 AC 4 ms
4,348 KB
testcase_07 AC 4 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 216 ms
5,856 KB
testcase_10 AC 207 ms
6,532 KB
testcase_11 AC 219 ms
6,532 KB
testcase_12 AC 217 ms
6,532 KB
testcase_13 AC 218 ms
6,532 KB
testcase_14 AC 222 ms
6,532 KB
testcase_15 AC 221 ms
6,532 KB
testcase_16 AC 221 ms
6,532 KB
testcase_17 AC 217 ms
6,416 KB
testcase_18 AC 212 ms
6,400 KB
testcase_19 AC 214 ms
6,352 KB
testcase_20 AC 218 ms
6,424 KB
testcase_21 AC 217 ms
6,532 KB
testcase_22 AC 217 ms
6,532 KB
testcase_23 AC 221 ms
6,532 KB
testcase_24 AC 208 ms
6,532 KB
testcase_25 AC 207 ms
6,532 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N,M,X;
int cnt[2<<17];
main()
{
	cin>>N>>M>>X;
	vector<pair<int,int> >AB(N);
	for(int i=0;i<N;i++)
	{
		int a,b;cin>>a>>b;
		AB[i]=make_pair(b,-a);
	}
	sort(AB.begin(),AB.end());
	vector<int>A(N);
	for(int i=0;i<N;i++)
	{
		int now=-AB[i].second;
		if(i==0||AB[i-1].first!=AB[i].first)now+=X;
		A[i]=now;
	}
	sort(A.rbegin(),A.rend());
	int K;cin>>K;
	for(int i=0;i<K;i++)
	{
		int c;cin>>c;
		cnt[c]++;
	}
	long ans=0,pc=K;
	for(int i=0;i<N;i++)
	{
		pc-=cnt[i];
		ans+=pc*A[i];
	}
	cout<<ans<<endl;
}
0