Submission #645385

# Submission time Handle Problem Language Result Execution time Memory
645385 2022-09-27T02:31:13 Z gun_gan Lasers (NOI19_lasers) C++17
21 / 100
38 ms 39944 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(l - i >= *S.rbegin()) ans--;
		for(auto j : s[i]) {
			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 16 ms 24276 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 16 ms 24276 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 38 ms 39944 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 11988 KB Output is correct
2 Correct 7 ms 12072 KB Output is correct
3 Correct 6 ms 11988 KB Output is correct
4 Correct 6 ms 12092 KB Output is correct
5 Correct 7 ms 12036 KB Output is correct
6 Correct 7 ms 11988 KB Output is correct
7 Correct 7 ms 12116 KB Output is correct
8 Correct 6 ms 12116 KB Output is correct
9 Correct 7 ms 12116 KB Output is correct
10 Correct 7 ms 11988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 38 ms 39944 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 16 ms 24276 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -