117812024-11-10 17:31:20MittomenSzemetessorcpp17Wrong answer 0/100252ms1264 KiB
#include <iostream>
#include <cstdint>

#define MIN(a, b) a < b ? a : b
#define MAX(a, b) a > b ? a : b

using namespace std;

// subtask 4 only
int main() {
	int n, k;
	int bins[200000] = {};
	int total = 0;

	cin >> n;
	cin >> k;

	int l = n, r = 0; // left and right ends of the interval

	int bin;
	int amount;

	for (int i = 0; i < n; i++) {
		cin >> amount;

		bins[i] = amount;
	}

	for (int i = 0; i < k; i++) {
		cin >> bin;
		cin >> amount;

		bins[bin] -= amount;

		l = MIN(l, bin);
		r = MAX(r, bin);
	}

	for (int i = l; i <= r; i++) {
		total += bins[i];
	}

	cout << total;
	
	return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer1ms1080 KiB
2Wrong answer2ms1080 KiB
subtask20/17
3Wrong answer2ms1080 KiB
4Wrong answer2ms996 KiB
5Wrong answer1ms1080 KiB
6Accepted1ms1080 KiB
7Wrong answer2ms1080 KiB
8Wrong answer2ms1080 KiB
9Wrong answer1ms1080 KiB
10Accepted2ms1080 KiB
11Wrong answer1ms1080 KiB
subtask30/25
12Wrong answer118ms1180 KiB
13Wrong answer115ms1176 KiB
14Wrong answer136ms1184 KiB
15Wrong answer135ms1176 KiB
16Wrong answer145ms1080 KiB
17Wrong answer192ms1176 KiB
18Wrong answer240ms1188 KiB
19Wrong answer246ms1184 KiB
20Wrong answer239ms1080 KiB
subtask40/20
21Wrong answer122ms1184 KiB
22Wrong answer143ms1080 KiB
23Wrong answer123ms1080 KiB
24Wrong answer144ms1080 KiB
25Wrong answer129ms1080 KiB
26Wrong answer189ms1080 KiB
27Wrong answer236ms1080 KiB
28Wrong answer236ms1180 KiB
29Wrong answer252ms1084 KiB
30Wrong answer207ms1184 KiB
subtask50/38
31Wrong answer2ms1080 KiB
32Wrong answer2ms1264 KiB
33Wrong answer2ms1080 KiB
34Wrong answer2ms1080 KiB
35Wrong answer13ms1180 KiB
36Wrong answer135ms1184 KiB
37Wrong answer240ms1080 KiB
38Wrong answer239ms1184 KiB
39Wrong answer239ms1176 KiB
40Wrong answer239ms1080 KiB
41Wrong answer238ms1260 KiB
42Wrong answer240ms1176 KiB