Submission #1003887

# Submission time Handle Problem Language Result Execution time Memory
1003887 2024-06-20T19:36:46 Z PagodePaiva Paint (COI20_paint) C++17
0 / 100
16 ms 6500 KB
#include<bits/stdc++.h>

using namespace std;

const int N = 200010;

int v[N];

int main(){
	int r, s;
	cin >> r >> s;
	int n = s;
	int q;
	for(int i = 0;i < n;i++){
		cin >> v[i];
	}
	set <array <int, 3>> ranges;
	for(int i = 0;i < n;i++){
		int l = i, r = i;
		while(v[l] == v[r] and r < n){
			r++;
		}
		r--;
		ranges.insert({l, r, v[i]});
		i = r;
	}
	cin >> q;
	for(int i = 0;i < q;i++){
		int _, t, cor;
		cin >> _ >> t >> cor;
		t--;
		auto it = ranges.lower_bound({t, 0, 0});
		int l = (*it)[0], r = (*it)[1];
		ranges.erase(it);
		it = ranges.lower_bound({t, 0, 0});
		if((*it)[2] == cor) r = (*it)[1];
		it--;
		if((*it)[2] == cor) l = (*it)[0];
		ranges.insert({l, r, cor});
	}
	for(auto x : ranges){
		for(int i = x[0];i <= x[1];i++){
			cout << x[2] << ' ';
		}
	}
	cout << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 16 ms 6500 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -