Submission #73888982
Source Code Expand
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<long long> pepper_stock(M + 1);
for (int j = 1; j <= M; ++j) {
cin >> pepper_stock[j];
}
vector<long long> total_demand(M + 1, 0);
for (int i = 0; i < N; ++i) {
int pepper_type;
long long max_gram;
cin >> pepper_type >> max_gram;
total_demand[pepper_type] += max_gram;
}
long long total_pepper = 0;
for (int j = 1; j <= M; ++j) {
total_pepper += min(total_demand[j], pepper_stock[j]);
}
cout << total_pepper;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Pepper Addiction |
| User | xuhanjin |
| Language | C++23 (GCC 15.2.0) |
| Score | 200 |
| Code Size | 669 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 3628 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| sample_01.txt | AC | 1 ms | 3628 KiB |
| sample_02.txt | AC | 1 ms | 3476 KiB |
| sample_03.txt | AC | 1 ms | 3532 KiB |
| test_01.txt | AC | 1 ms | 3500 KiB |
| test_02.txt | AC | 1 ms | 3464 KiB |
| test_03.txt | AC | 1 ms | 3500 KiB |
| test_04.txt | AC | 1 ms | 3404 KiB |
| test_05.txt | AC | 1 ms | 3476 KiB |
| test_06.txt | AC | 1 ms | 3448 KiB |
| test_07.txt | AC | 1 ms | 3596 KiB |
| test_08.txt | AC | 1 ms | 3464 KiB |
| test_09.txt | AC | 1 ms | 3532 KiB |
| test_10.txt | AC | 1 ms | 3464 KiB |
| test_11.txt | AC | 1 ms | 3592 KiB |
| test_12.txt | AC | 1 ms | 3548 KiB |
| test_13.txt | AC | 1 ms | 3592 KiB |
| test_14.txt | AC | 1 ms | 3476 KiB |
| test_15.txt | AC | 1 ms | 3476 KiB |
| test_16.txt | AC | 1 ms | 3476 KiB |
| test_17.txt | AC | 1 ms | 3528 KiB |