結果

問題 No.2197 Same Dish
ユーザー 👑 potato167potato167
提出日時 2023-01-21 02:29:06
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 431 bytes
コンパイル時間 2,158 ms
コンパイル使用メモリ 202,880 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 18:29:02
合計ジャッジ時間 3,830 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 11 ms
4,380 KB
testcase_14 AC 63 ms
4,376 KB
testcase_15 AC 71 ms
4,376 KB
testcase_16 AC 47 ms
4,380 KB
testcase_17 AC 41 ms
4,376 KB
testcase_18 AC 72 ms
4,380 KB
testcase_19 AC 73 ms
4,380 KB
testcase_20 AC 72 ms
4,380 KB
testcase_21 AC 71 ms
4,376 KB
testcase_22 AC 70 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
using ll = long long;
#define all(p) p.begin(),p.end()

int main(){
	const int mod=998244353;
	ll A=1,B=1;
	ll N,K;
	cin>>N>>K;
	vector<int> p(N*2);
	rep(i,0,N){
		A=(A*K)%mod;
		int a,b;
		cin>>a>>b;
		p[i*2]=a*10;
		p[i*2+1]=b*10-1;
	}
	sort(all(p));
	rep(i,0,N*2){
		if(p[i]%10==0) B=(B*K)%mod,K--;
		else K++;
	}
	cout<<(A-B+mod)%mod<<"\n";
}
0