Submission #17740

#TimeUsernameProblemLanguageResultExecution timeMemory
17740AdilkhanEnergetic turtle (IZhO11_turtle)C++98
0 / 100
12 ms632 KiB
#include <bits/stdc++.h> #define pb push_back #define endl "\n" #define mp make_pair #define fi first #define se second #define all(x) x.begin(), x.end() #define fname "" #define sz(x) (int)(x.size()) typedef long long ll; using namespace std; const ll N = (ll)(5e5) + 322; const ll INF = (ll)(1e9); const ll mod = (ll)(1e9) + 7; const double eps = 1e-9; ll n, m, a[1000][1000], d[1000][1000][20], z, k, t, x, y, sum; int main () { // freopen(fname".in", "r", stdin); //freopen(fname".out", "w", stdout); scanf("%lld%lld%lld%lld%lld", &n, &m, &k, &t, &z); for (int i = 1; i <= k; ++i) { scanf("%lld%lld", &x, &y); a[x][y] = 1; } d[0][0][0] = 1; for (int i = 0; i <= n; ++i) { for (int j = 0; j <= m; ++j) { if (i == 0 && j == 0) continue; if (a[i][j] == 1) { for (int q = 1; q <= k; ++q) { d[i][j][q] = (d[i - 1][j][q - 1] + d[i][j][q]) % z; d[i][j][q] = (d[i][j - 1][q - 1] + d[i][j][q]) % z; } }else { for (int q = 0; q <= k; ++q) { d[i][j][q] = (d[i - 1][j][q] + d[i][j][q]) % z; d[i][j][q] = (d[i][j - 1][q] + d[i][j][q]) % z; } } } } for (int i = 0; i <= t; ++i) { sum += d[n][m][i]; sum %= z; } printf("%lld", sum); return 0; }

Compilation message (stderr)

turtle.cpp: In function 'int main()':
turtle.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld%lld%lld%lld", &n, &m, &k, &t, &z);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
turtle.cpp:28:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%lld%lld", &x, &y);
    ~~~~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...