結果
| 問題 |
No.2197 Same Dish
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-20 22:03:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 47 ms / 2,000 ms |
| コード長 | 1,337 bytes |
| コンパイル時間 | 1,879 ms |
| コンパイル使用メモリ | 194,464 KB |
| 実行使用メモリ | 7,532 KB |
| 最終ジャッジ日時 | 2024-06-23 10:01:47 |
| 合計ジャッジ時間 | 3,193 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:42:19: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
42 | for (auto [t, ty]: events) {
| ^
ソースコード
#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;
}