Submission #2997560
Source Code Expand
#include <bits/stdc++.h> #if MYDEBUG #include "lib/cp_debug.hpp" #else #define DBG(...) ; #endif #if __cplusplus <= 201402L template <typename T> T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); } template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } #endif using LL = long long; constexpr LL LINF = 334ll << 53; constexpr int INF = 15 << 26; constexpr LL MOD = 1E9 + 7; namespace Problem { using namespace std; class Solver2 { public: int a, b; vector<vector<int>> d, lBound; Solver2(LL n, LL m) : a(n), b(m), d(a + 1, vector<int>(b + 1)), lBound(101, vector<int>(101, 0)){}; void impossible() { cout << "Impossible" << endl; exit(0); } void solve() { for (int i = 1; i <= a; ++i) { for (int j = 1; j <= b; ++j) { cin >> d[i][j]; } } for (int i = 0; i <= a; ++i) { for (int j = 0; j <= b; ++j) { for (int k = 0; k <= 100; ++k) { for (int l = 0; l <= 100; ++l) { //path with 'X' : k times //path with 'Y' : l times lBound[k][l] = max(lBound[k][l], d[i][j] - i * k - j * l); } } } } for (int i = 0; i <= a; ++i) { for (int j = 0; j <= b; ++j) { int minDistance = INF; for (int k = 0; k <= 100; ++k) { for (int l = 0; l <= 100; ++l) { minDistance = min(minDistance, a * k + b * l + lBound[k][l]); } } if (minDistance > d[a][b]) impossible(); } } cout << "202 10401" << endl; for (int k = 0; k <= 100; ++k) { for (int l = 0; l <= 100; ++l) { cout << k + 1 << ' ' << 102 + l << ' ' << lBound[k][l] << endl; } } for (int i = 0; i < 100; ++i) { cout << i + 1 << ' ' << i + 2 << " X" << endl; cout << i + 102 << ' ' << i + 103 << " Y" << endl; } cout << "1 202" << endl; } }; } // namespace Problem int main() { std::cin.tie(0); std::ios_base::sync_with_stdio(false); // std::cout << std::fixed << std::setprecision(12); long long n = 0, m; std::cin >> n >> m; Problem::Solver2 sol(n, m); sol.solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - GraphXY |
User | Hoi_koro |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 2224 Byte |
Status | WA |
Exec Time | 22 ms |
Memory | 384 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 900 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt |
All | 0_000.txt, 0_001.txt, 1_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt, 1_028.txt, 1_029.txt, 1_030.txt, 1_031.txt, 1_032.txt, 1_033.txt, 1_034.txt, 1_035.txt, 1_036.txt, 1_037.txt, 1_038.txt, 1_039.txt, 1_040.txt, 1_041.txt, 1_042.txt, 1_043.txt, 1_044.txt, 1_045.txt, 1_046.txt, 1_047.txt, 1_048.txt, 1_049.txt, 1_050.txt, 1_051.txt, 1_052.txt, 1_053.txt, 1_054.txt, 1_055.txt, 1_056.txt, 1_057.txt, 1_058.txt, 1_059.txt, 1_060.txt, 1_061.txt, 1_062.txt, 1_063.txt, 1_064.txt, 1_065.txt, 1_066.txt, 1_067.txt, 1_068.txt, 1_069.txt, 1_070.txt, 1_071.txt, 1_072.txt, 1_073.txt, 1_074.txt, 1_075.txt, 1_076.txt, 1_077.txt, 1_078.txt, 1_079.txt, 1_080.txt, 1_081.txt, 1_082.txt, 1_083.txt, 1_084.txt, 1_085.txt, 1_086.txt, 1_087.txt, 1_088.txt, 1_089.txt, 1_090.txt, 1_091.txt, 1_092.txt, 1_093.txt, 1_094.txt, 1_095.txt, 1_096.txt, 1_097.txt, 1_098.txt, 1_099.txt, 1_100.txt, 1_101.txt, 1_102.txt, 1_103.txt, 1_104.txt, 1_105.txt, 1_106.txt, 1_107.txt, 1_108.txt, 1_109.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | WA | 19 ms | 384 KB |
0_001.txt | AC | 1 ms | 256 KB |
1_002.txt | WA | 21 ms | 384 KB |
1_003.txt | WA | 21 ms | 384 KB |
1_004.txt | WA | 21 ms | 384 KB |
1_005.txt | WA | 19 ms | 384 KB |
1_006.txt | WA | 18 ms | 384 KB |
1_007.txt | WA | 19 ms | 384 KB |
1_008.txt | WA | 19 ms | 384 KB |
1_009.txt | WA | 19 ms | 384 KB |
1_010.txt | WA | 19 ms | 384 KB |
1_011.txt | WA | 19 ms | 384 KB |
1_012.txt | WA | 19 ms | 384 KB |
1_013.txt | WA | 19 ms | 384 KB |
1_014.txt | WA | 22 ms | 384 KB |
1_015.txt | WA | 21 ms | 384 KB |
1_016.txt | WA | 21 ms | 384 KB |
1_017.txt | WA | 21 ms | 384 KB |
1_018.txt | WA | 21 ms | 384 KB |
1_019.txt | WA | 21 ms | 384 KB |
1_020.txt | WA | 19 ms | 384 KB |
1_021.txt | WA | 19 ms | 384 KB |
1_022.txt | WA | 19 ms | 384 KB |
1_023.txt | WA | 19 ms | 384 KB |
1_024.txt | WA | 19 ms | 384 KB |
1_025.txt | WA | 19 ms | 384 KB |
1_026.txt | WA | 19 ms | 384 KB |
1_027.txt | WA | 19 ms | 384 KB |
1_028.txt | WA | 19 ms | 384 KB |
1_029.txt | WA | 19 ms | 384 KB |
1_030.txt | WA | 19 ms | 384 KB |
1_031.txt | WA | 19 ms | 384 KB |
1_032.txt | WA | 19 ms | 384 KB |
1_033.txt | WA | 20 ms | 384 KB |
1_034.txt | WA | 20 ms | 384 KB |
1_035.txt | WA | 19 ms | 384 KB |
1_036.txt | WA | 19 ms | 384 KB |
1_037.txt | WA | 19 ms | 384 KB |
1_038.txt | WA | 19 ms | 384 KB |
1_039.txt | WA | 19 ms | 384 KB |
1_040.txt | WA | 19 ms | 384 KB |
1_041.txt | WA | 19 ms | 384 KB |
1_042.txt | WA | 19 ms | 384 KB |
1_043.txt | WA | 19 ms | 384 KB |
1_044.txt | WA | 19 ms | 384 KB |
1_045.txt | WA | 20 ms | 384 KB |
1_046.txt | WA | 20 ms | 384 KB |
1_047.txt | WA | 20 ms | 384 KB |
1_048.txt | WA | 20 ms | 384 KB |
1_049.txt | WA | 20 ms | 384 KB |
1_050.txt | WA | 19 ms | 384 KB |
1_051.txt | WA | 19 ms | 384 KB |
1_052.txt | WA | 19 ms | 384 KB |
1_053.txt | WA | 19 ms | 384 KB |
1_054.txt | WA | 19 ms | 384 KB |
1_055.txt | WA | 20 ms | 384 KB |
1_056.txt | WA | 20 ms | 384 KB |
1_057.txt | WA | 19 ms | 384 KB |
1_058.txt | WA | 19 ms | 384 KB |
1_059.txt | WA | 21 ms | 384 KB |
1_060.txt | WA | 21 ms | 384 KB |
1_061.txt | WA | 21 ms | 384 KB |
1_062.txt | WA | 21 ms | 384 KB |
1_063.txt | WA | 21 ms | 384 KB |
1_064.txt | WA | 21 ms | 384 KB |
1_065.txt | WA | 19 ms | 384 KB |
1_066.txt | WA | 19 ms | 384 KB |
1_067.txt | WA | 19 ms | 384 KB |
1_068.txt | WA | 19 ms | 384 KB |
1_069.txt | WA | 19 ms | 384 KB |
1_070.txt | AC | 1 ms | 256 KB |
1_071.txt | WA | 19 ms | 384 KB |
1_072.txt | WA | 19 ms | 384 KB |
1_073.txt | WA | 19 ms | 384 KB |
1_074.txt | WA | 19 ms | 384 KB |
1_075.txt | WA | 19 ms | 384 KB |
1_076.txt | WA | 19 ms | 384 KB |
1_077.txt | WA | 19 ms | 384 KB |
1_078.txt | WA | 19 ms | 384 KB |
1_079.txt | WA | 19 ms | 384 KB |
1_080.txt | WA | 19 ms | 384 KB |
1_081.txt | WA | 19 ms | 384 KB |
1_082.txt | WA | 19 ms | 384 KB |
1_083.txt | AC | 1 ms | 256 KB |
1_084.txt | WA | 19 ms | 384 KB |
1_085.txt | WA | 19 ms | 384 KB |
1_086.txt | WA | 19 ms | 384 KB |
1_087.txt | WA | 19 ms | 384 KB |
1_088.txt | WA | 19 ms | 384 KB |
1_089.txt | WA | 19 ms | 384 KB |
1_090.txt | WA | 20 ms | 384 KB |
1_091.txt | WA | 20 ms | 384 KB |
1_092.txt | WA | 19 ms | 384 KB |
1_093.txt | WA | 19 ms | 384 KB |
1_094.txt | WA | 20 ms | 384 KB |
1_095.txt | WA | 19 ms | 384 KB |
1_096.txt | WA | 19 ms | 384 KB |
1_097.txt | WA | 20 ms | 384 KB |
1_098.txt | WA | 19 ms | 384 KB |
1_099.txt | WA | 19 ms | 384 KB |
1_100.txt | WA | 19 ms | 384 KB |
1_101.txt | WA | 19 ms | 384 KB |
1_102.txt | WA | 20 ms | 384 KB |
1_103.txt | WA | 20 ms | 384 KB |
1_104.txt | WA | 20 ms | 384 KB |
1_105.txt | WA | 21 ms | 384 KB |
1_106.txt | WA | 21 ms | 384 KB |
1_107.txt | WA | 21 ms | 384 KB |
1_108.txt | WA | 21 ms | 384 KB |
1_109.txt | WA | 22 ms | 384 KB |
for_sample.txt | WA | 19 ms | 384 KB |