Submission #237778

#TimeUsernameProblemLanguageResultExecution timeMemory
237778Haunted_CppLasers (NOI19_lasers)C++17
63 / 100
150 ms8584 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; int dp [N]; bool is_invalid [N]; int main () { ios::sync_with_stdio(0); cin.tie(0); int l, r, res = 0; cin >> l >> r; memset (dp, 0, sizeof(dp)); for (int T = 0; T < r; T++) { int qts; cin >> qts; int s = 0; vector<int> arr (qts); for (int i = 0; i < qts; i++) { cin >> arr[i]; s += arr[i]; } int cur = 0; int mn = 0; for (int i = 0; i < qts; i++) { ++dp[max (mn, cur)]; --dp[l - s - 1 + 1]; mn = max (mn, l - s); cur += arr[i]; s -= arr[i]; } ++dp[max (mn, cur)]; --dp[l - s - 1 + 1]; } int x = 0; for (int i = 0; i < l; i++) { x += dp[i]; if (x != r) ++res; } cout << res << '\n'; return 0; }
#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...