Submission #873340

#TimeUsernameProblemLanguageResultExecution timeMemory
873340bobbilykingCalvinball championship (CEOI15_teams)C++17
20 / 100
133 ms756 KiB
#pragma GCC target ("avx2") #pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include<bits/stdc++.h> #include<math.h> using namespace std; typedef long long int ll; typedef long double ld; typedef pair<ll, ll> pl; #define K first #define V second #define G(x) ll x; cin >> x; #define GD(x) ld x; cin >> x; #define GS(s) string s; cin >> s; #define EX(x) { cout << x << '\n'; exit(0); } #define A(a) (a).begin(), (a).end() #define F(i, l, r) for (ll i = (l); i < r; ++i) #define NN 10010 #define M 1000007 // 998244353 ll dp[2][NN]; ll n_dp = 0; int main(){ // freopen("a.in", "r", stdin); // freopen("a.out", "w", stdout); ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20); fill(dp[0], dp[0]+NN, 1ll); G(n) vector<ll> a(n), mxes(n); ll mx = 1; ll answer = 1; F(i, 0, n) { cin >> a[i]; mxes[i] = mx; mx = max(mx, a[i]); } for (ll left = n-1; left >=0; --left) { (answer = answer + (a[left]-1) * dp[n_dp][mxes[left]])%M; n_dp ^= 1; F(l, 0, NN-1) { dp[n_dp][l] = (l * dp[n_dp^1][l] + dp[n_dp^1][l+1])%M; } dp[n_dp][NN-1] = (NN-1) * dp[n_dp^1][NN-1]%M; } cout << answer << '\n'; }

Compilation message (stderr)

teams.cpp: In function 'int main()':
teams.cpp:48:63: warning: value computed is not used [-Wunused-value]
   48 |         (answer = answer + (a[left]-1) * dp[n_dp][mxes[left]])%M;
      |                                                               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...