結果

問題 No.2197 Same Dish
ユーザー Lim AloysiusLim Aloysius
提出日時 2023-01-20 22:03:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 1,337 bytes
コンパイル時間 2,311 ms
コンパイル使用メモリ 192,124 KB
実行使用メモリ 9,008 KB
最終ジャッジ日時 2023-09-05 14:21:06
合計ジャッジ時間 3,443 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 7 ms
4,384 KB
testcase_14 AC 40 ms
8,012 KB
testcase_15 AC 44 ms
7,436 KB
testcase_16 AC 30 ms
5,128 KB
testcase_17 AC 26 ms
5,356 KB
testcase_18 AC 46 ms
7,776 KB
testcase_19 AC 45 ms
8,156 KB
testcase_20 AC 46 ms
9,008 KB
testcase_21 AC 45 ms
8,560 KB
testcase_22 AC 42 ms
8,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:42:19: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   42 |         for (auto [t, ty]: events) {
      |                   ^

ソースコード

diff #

#ifdef MY_LOCAL
#include "D://competitive_programming/debug/debug.h"
#define debug(x) cerr << "[" << #x<< "]:"<<x<<"\n"
#else
#define debug(x) 
#endif
#define REP(i, n) for(int i = 0; i < n; i ++)
#define REPL(i,m, n) for(int i = m; i < n; i ++)
#define SORT(arr) sort(arr.begin(), arr.end())
#define LSOne(S) ((S)&-(S))
#define M_PI 3.1415926535897932384
#define INF 1e18
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef double ld;
typedef tree<int,null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ost;
const int MOD = 998244353;
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,k;cin>>n>>k;
	vector<ii> events;
	REP(i, n) {
		int l,r;cin>>l>>r;
		events.push_back({l, i+1});
		events.push_back({r, -i-1});
	}
	SORT(events);
	int bad = 1;
	int curav = k;
	for (auto [t, ty]: events) {
		if (ty < 0) curav++;
		if (ty > 0) {
			//debug(curav);
			int nn = max(0LL, curav);
			bad *= nn;
			bad %= MOD;
			curav--;
		}
	}
	//debug(bad);
	int tot = 1;
	REP(i, n) {
		tot *= k;
		tot %= MOD;
	}
	cout<<(tot-bad+MOD)%MOD;
}
0