# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
974651 |
2024-05-03T15:08:03 Z |
vjudge1 |
Pizza (COCI21_pizza) |
C++17 |
|
1 ms |
360 KB |
#include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;
int main() {
// Membaca input
int N;
cin >> N;
// Memvalidasi batasan N
if (N < 1 || N > 100) {
cerr << "Batasan N tidak terpenuhi." << endl;
return 1;
}
unordered_set<int> tidak_disukai;
for (int i = 0; i < N; ++i) {
int merk;
cin >> merk;
// Memvalidasi batasan Ai
if (merk < 1 || merk > 100) {
cerr << "Batasan Ai tidak terpenuhi." << endl;
return 1;
}
tidak_disukai.insert(merk);
}
int M;
cin >> M;
// Memvalidasi batasan M
if (M < 1 || M > 100) {
cerr << "Batasan M tidak terpenuhi." << endl;
return 1;
}
int jumlah_bingkisan_dapat_dibeli = 0;
for (int i = 0; i < M; ++i) {
int K;
cin >> K;
// Memvalidasi batasan Ki
if (K < 1 || K > 100) {
cerr << "Batasan Ki tidak terpenuhi." << endl;
return 1;
}
bool bingkisan_cocok = true;
for (int j = 0; j < K; ++j) {
int merk;
cin >> merk;
// Memvalidasi batasan Bi,j
if (merk < 1 || merk > 100) {
cerr << "Batasan Bi,j tidak terpenuhi." << endl;
return 1;
}
if (tidak_disukai.count(merk)) {
bingkisan_cocok = false;
}
}
if (bingkisan_cocok) {
jumlah_bingkisan_dapat_dibeli++;
}
}
// Menampilkan jumlah bingkisan yang dapat dibeli
cout << jumlah_bingkisan_dapat_dibeli << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
360 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |