# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
246229 | 2020-07-08T11:58:04 Z | SamAnd | Journey (NOI18_journey) | C++17 | 6 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; #define m_p make_pair #define all(x) (x).begin(),(x).end() #define sz(x) ((int)(x).size()) #define fi first #define se second typedef long long ll; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); mt19937 rnf(2106); const int N = 10004, M = 402, H = 102, U = 500000001; int n, m, q; pair<int, int> g[N][H]; int dp[N][M]; void solv() { scanf("%d%d%d", &n, &m, &q); for (int i = 0; i < n - 1; ++i) { for (int j = 0; j < q; ++j) scanf("%d%d", &g[i][j].fi, &g[i][j].se); } dp[0][0] = 1; for (int x = 0; x < n - 1; ++x) { for (int y = 1; y < m; ++y) { dp[x][y] += dp[x][y - 1]; dp[x][y] = min(dp[x][y], U); } for (int y = 0; y < m; ++y) { for (int i = 0; i < q; ++i) { int h = g[x][i].fi; int d = g[x][i].se; if (h < x) continue; if (y + d < m) { dp[h][y + d] += dp[x][y]; dp[h][y + d] = min(dp[h][y + d], U); } } } } for (int y = 0; y < m; ++y) printf("%d ", dp[n - 1][y]); printf("\n"); } int main() { #ifdef SOMETHING freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); #endif // SOMETHING //ios_base::sync_with_stdio(false), cin.tie(0); solv(); return 0; } //while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Incorrect | 6 ms | 384 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Incorrect | 6 ms | 384 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |