結果
問題 | No.1400 すごろくで世界旅行 |
ユーザー | yosswi414 |
提出日時 | 2020-12-09 00:49:45 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,619 bytes |
コンパイル時間 | 2,400 ms |
コンパイル使用メモリ | 216,732 KB |
実行使用メモリ | 21,284 KB |
最終ジャッジ日時 | 2024-11-28 15:52:10 |
合計ジャッジ時間 | 34,172 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
11,044 KB |
testcase_01 | AC | 2 ms
10,920 KB |
testcase_02 | AC | 2 ms
13,636 KB |
testcase_03 | AC | 59 ms
13,728 KB |
testcase_04 | AC | 10 ms
13,632 KB |
testcase_05 | AC | 14 ms
13,728 KB |
testcase_06 | AC | 384 ms
13,632 KB |
testcase_07 | AC | 881 ms
13,728 KB |
testcase_08 | AC | 72 ms
13,632 KB |
testcase_09 | AC | 58 ms
21,284 KB |
testcase_10 | AC | 157 ms
13,636 KB |
testcase_11 | AC | 45 ms
13,640 KB |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | AC | 2 ms
6,816 KB |
testcase_20 | AC | 2 ms
13,640 KB |
ソースコード
// head of mylib.h #include <bits/stdc++.h> using ll = long long; using ull = unsigned long long; using pi = std::pair<ll, ll>; #define chmin(x, a) ((x) = std::min({(x), (a)}) #define chmax(x, a) ((x) = std::max({(x), (a)}) template <class T> class V : public std::vector<T> { typedef std::vector<T> vector; public: using vector::begin; using vector::end; using vector::operator[]; using vector::back; using vector::clear; using vector::const_iterator; using vector::empty; using vector::erase; using vector::front; using vector::insert; using vector::iterator; using vector::pop_back; using vector::push_back; using vector::rbegin; using vector::rend; using vector::resize; using vector::size; using vector::vector; ll sum() const { ll x = 0; std::cout << "sum()" << std::endl; return x; } ll max() const { ll x = std::numeric_limits<ll>::min(); std::cout << "max()" << std::endl; return x; } ll min() const { ll x = std::numeric_limits<ll>::max(); std::cout << "min()" << std::endl; return x; } }; template <class T> using VV = V<V<T>>; template <class T> std::ostream& operator<<(std::ostream& os, const V<T>& v) { for (auto itr = v.begin(); itr != v.end();++itr) os << (itr != v.begin() ? " " : "") << *itr; os << std::endl; return os; } template <class T> std::istream& operator>>(std::istream& is, V<T>& v) { for (auto& i : v) is >> i; return is; } void fin(const char* str){ std::cout << str << std::endl; exit(0); } // end of mylib.h using namespace std; VV<bool> prodOR(VV<bool> A, VV<bool> B){ int a = A.size(), b = B.size(), c = B.front().size(); VV<bool> X(a, V<bool>(c, false)); for (int i = 0; i < a;++i){ for (int j = 0; j < b; ++j) { for (int k = 0; k < c; ++k) { X[i][k] = X[i][k] || (A[i][j] && B[j][k]); } } } return X; } int main() { int v, d; cin >> v >> d; V<string> input(v); VV<bool> e(v, V<bool>(v, false)), t, res = e; for (int i = 0; i < v; ++i) res[i][i] = true; cin >> input; for (int i = 0; i < v;++i){ for (int j = 0; j < v;++j){ e[i][j] = (input[i][j] == '1'); } } t = e; while(d > 0) { if (d & 1) res = prodOR(res, t); d /= 2; t = prodOR(t, t); } cerr << res << endl; for(auto vb : res)for(auto i:vb) if (!i) return cout << "No" << endl, 0; cout << "Yes" << endl; }