Submission #901574

# Submission time Handle Problem Language Result Execution time Memory
901574 2024-01-09T15:28:36 Z duckindog Magneti (COCI21_magneti) C++14
0 / 110
4 ms 756 KB
// from duckindog wth depression
#include<bits/stdc++.h>

using namespace std;

const int N = 50 + 10,
          L = 1e4 + 10,
          M = 1e9 + 7;
int n, l;
int r[N];
void sub1() {
  vector<long long> d(l + 1), f(l + 1);
  const int x = r[1];
  for (int i = 1; i <= l; ++i) d[i] = (d[i - 1] + n) % M;

  for (int i = 2; i <= n; ++i) {

    fill(f.begin(), f.end(), 0);

    for (int j = i * x; j <= l; ++j) f[j] = (d[j - x] * (n - i + 1)) % M;

    for (int j = 1; j <= l; ++j) d[j] = (d[j - 1] + f[j]) % M;

  }
  cout << d[l];
}

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

Main.cpp: In function 'int32_t main()':
Main.cpp:32:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |     freopen("duck.inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:33:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |     freopen("duck.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 600 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 756 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 600 KB Output isn't correct
4 Halted 0 ms 0 KB -