Submission #645386

# Submission time Handle Problem Language Result Execution time Memory
645386 2022-09-27T02:33:43 Z gun_gan Lasers (NOI19_lasers) C++17
21 / 100
41 ms 39956 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 5e5 + 5;
int l, r, curr[N], sum[N];
vector<int> s[N];
multiset<int> S;

int main() {
	cin.tie(0); ios_base::sync_with_stdio(0);

	cin >> l >> r;
	int ans = l;
	for(int i = 0; i < r; i++) {
		int x; cin >> x;
		for(int j = 0; j < x; j++) {
			int p; cin >> p;
			sum[i] += p;
			s[sum[i]].push_back(i);
		}
		S.insert(sum[i]);
	}
	for(int i = 1; i <= l; i++) {
		if(!S.empty() && l - i >= *S.rbegin()) ans--;
		for(auto j : s[i]) {
			if(S.empty()) continue;
			S.erase(S.find(sum[j] - curr[j]));
			curr[j] = i;
			S.insert(sum[j] - curr[j]);
		}
	}
	cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 24276 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 24276 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 41 ms 39956 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 11988 KB Output is correct
2 Correct 6 ms 11980 KB Output is correct
3 Correct 6 ms 12088 KB Output is correct
4 Correct 6 ms 11988 KB Output is correct
5 Correct 6 ms 11988 KB Output is correct
6 Correct 9 ms 12092 KB Output is correct
7 Correct 6 ms 12116 KB Output is correct
8 Correct 7 ms 12152 KB Output is correct
9 Correct 7 ms 12040 KB Output is correct
10 Correct 7 ms 11988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 41 ms 39956 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 17 ms 24276 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -