結果
| 問題 | No.3453 Crape Shop |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-28 13:33:35 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 807 bytes |
| 記録 | |
| コンパイル時間 | 2,249 ms |
| コンパイル使用メモリ | 195,632 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-02-28 13:33:39 |
| 合計ジャッジ時間 | 2,712 ms |
|
ジャッジサーバーID (参考情報) |
judge7 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> Pii;
const ll mod = 998244353;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
int a, b;
cin >> a >> b;
vector<int> p(n);
for (auto &x: p) cin >> x;
int a_rem = a;
int b_rem = b;
for (int i = 0; i < n; i++) {
if (p[i] == 1) {
a_rem--;
}
else if (p[i] == 2) {
b_rem--;
}
else if (p[i] == 3) {
a_rem--;
b_rem--;
}
if (a_rem < 0 || b_rem < 0) {
cout << i + 1 << endl;
return 0;
}
}
cout << -1 << endl;
return 0;
}