結果

問題 No.801 エレベーター
ユーザー olpheolphe
提出日時 2019-03-17 22:02:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,089 bytes
コンパイル時間 1,160 ms
コンパイル使用メモリ 117,640 KB
実行使用メモリ 43,028 KB
最終ジャッジ日時 2023-09-22 06:09:28
合計ジャッジ時間 5,966 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
11,476 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"

using namespace std;

//const long long int MOD = 1000000007;
const int MOD = 998244353;

//long long int N, M, K, H, W, L, R;
int N, M, K, H, W, L, R;

void Solve(vector<vector<int>>&box, int num, vector<int>&st) {
	//auto by = box;
	//bool flag = true;
	//for (int i = 0; i < 12; i++) {
	//	if ((num >> i) & 1) {
	//		if (flag) {
	//			by = box;
	//		}
	//		else {
	//			auto bag = by;
	//			for (int j = 0; j < N; j++) {
	//				for (int k = 0; k < N; k++) {
	//					by[j][k] = 0;
	//					for (int l = 0; l < N; l++) {
	//						by[j][k] = ((long long int)bag[j][l] * box[l][k] + by[j][k]) % MOD;
	//					}
	//				}
	//			}
	//		}
	//	}
	//	auto bag = box;
	//	for (int j = 0; j < N; j++) {
	//		for (int k = 0; k < N; k++) {
	//			box[j][k] = 0;
	//			for (int l = 0; l < N; l++) {
	//				box[j][k] = ((long long int)bag[j][l] * bag[l][k] + box[j][k]) % MOD;
	//			}
	//		}
	//	}
	//}
	for (int i = 0; i < K; i++) {
		auto bag = st;
		for (int j = 0; j < N; j++) {
			st[j] = 0;
			for (int k = 0; k < N; k++) {
				st[j] = ((long long int)bag[k] * box[j][k] + st[j]) % MOD;
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N >> M >> K;
	vector<pair<int, int>>v(M);
	for (auto &i : v) {
		cin >> i.first >> i.second;
		i.first--;
		i.second--;
	}
	vector<int>st(N);
	st[0] = 1;
	vector<vector<int>>box(N, vector<int>(N));
	for (int i = 0; i < N; i++) {
		for (auto j : v) {
			if (j.first > i || j.second < i)continue;
			box[j.first][i]++;
			if (j.second + 1 != N)box[j.second + 1][i]--;
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 1; j < N; j++) {
			box[j][i] += box[j - 1][i];
		}
	}
	Solve(box, K, st);
	//for (auto i : st)cout << i << endl;
	cout << st.back() << endl;
	return 0;
}
0