58302023-10-03 17:08:38TaxiradioVállalkozócpp11Wrong answer 0/4026ms4688 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n , m;cin >> n >> m;
	vector<int> days , works;
	works.resize(n+1 , 0);
	days.push_back(0);
	for(int i = 0; i < n; i++){
		int y; cin >> y;
		days.push_back(y);
	}
	days.push_back(0);
	for(int i = 0; i < m; i++){
		int y; cin >> y;
		works[y]++;
	}
	cout << endl;
	int maxWorks = 0;
	for(int i = 1; i <= n; i++){
		maxWorks += (works[i] <= days[i])? works[i] : days[i];
		days[i+1] += max(0 , days[i]-works[i]);
	}
	cout << maxWorks << endl;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Wrong answer0/03ms1808 KiB
2Wrong answer0/026ms2012 KiB
3Wrong answer0/23ms2492 KiB
4Wrong answer0/23ms2652 KiB
5Wrong answer0/23ms2780 KiB
6Wrong answer0/23ms2920 KiB
7Wrong answer0/24ms3132 KiB
8Wrong answer0/23ms3096 KiB
9Wrong answer0/24ms3224 KiB
10Wrong answer0/23ms3436 KiB
11Wrong answer0/23ms3520 KiB
12Wrong answer0/23ms3644 KiB
13Wrong answer0/24ms3860 KiB
14Wrong answer0/24ms3948 KiB
15Wrong answer0/28ms3944 KiB
16Wrong answer0/28ms3948 KiB
17Wrong answer0/214ms4600 KiB
18Wrong answer0/210ms4468 KiB
19Wrong answer0/213ms4576 KiB
20Wrong answer0/214ms4548 KiB
21Wrong answer0/219ms4516 KiB
22Wrong answer0/226ms4688 KiB