Submission #235138

#TimeUsernameProblemLanguageResultExecution timeMemory
235138NONAMESan (COCI17_san)C++17
96 / 120
366 ms65540 KiB
#include <bits/stdc++.h> #define ft first #define sd second using namespace std; typedef long long ll; int n, h[50]; ll k, g[50], ans; map <ll, ll> sum[50]; int main() { cin >> n >> k; for (int i = 0; i < n; i++) cin >> h[i] >> g[i], sum[i][min(g[i], k)] = 1; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) { if (h[i] > h[j]) continue; for (auto sm : sum[i]) sum[j][min(k, sm.ft + g[j])] += sm.sd; } for (int i = 0; i < n; i++) ans += sum[i][k]; cout << ans; }
#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...