Submission #246228

#TimeUsernameProblemLanguageResultExecution timeMemory
246228SamAndJourney (NOI18_journey)C++17
100 / 100
171 ms25696 KiB
#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 (stderr)

journey.cpp: In function 'void solv()':
journey.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &n, &m, &q);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
journey.cpp:24:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d%d", &g[i][j].fi, &g[i][j].se);
             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...