Submission #901566

#TimeUsernameProblemLanguageResultExecution timeMemory
901566duckindogMagneti (COCI21_magneti)C++14
0 / 110
1072 ms604 KiB
// from duckindog wth depression #include<bits/stdc++.h> using namespace std; const int N = 50 + 10, L = 1e4 + 10, M = 19 + 7; int n, l; int r[N]; void sub1() { vector<vector<long long>> f(2, vector<long long> (l + 1)); const int x = r[1]; for (int i = 1; i <= l; ++i) f[1][i] = n; for (int i = 2; i <= n; ++i) { int it = i & 1; for (int j = 0; j <= l; ++j) f[it][j] = 0; for (int j = x; j <= l; ++j) { auto &ret = f[it][j]; for (int t = 0; t <= j - x; ++t) ret = (ret + f[it ^ 1][t]) % M; ret = (ret * (n - i + 1)) % M; } } long long answer = 0; for (int i = 0; i <= l; ++i) answer = (answer + f[n & 1][i]) % M; cout << answer; } int32_t main() { cin.tie(0)->sync_with_stdio(0); if (fopen("duck.inp", "r")) { freopen("duck.inp", "r", stdin); freopen("duck.out", "w", stdout); } cin >> n >> l; for(int i = 1; i <= n; ++i) cin >> r[i]; sort(r + 1, r + n + 1); int sub = r[1] == r[n] ? 1 : n <= 10 ? 2 : (n <= 30 && l <= 300) ? 3 : 4; if (sub == 1) { sub1(); return 0; } }

Compilation message (stderr)

Main.cpp: In function 'int32_t main()':
Main.cpp:34:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |     freopen("duck.inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:35:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |     freopen("duck.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...