結果

問題 No.3453 Crape Shop
コンテスト
ユーザー coco0715
提出日時 2026-03-08 15:45:47
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,383 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,441 ms
コンパイル使用メモリ 184,776 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-08 15:48:54
合計ジャッジ時間 2,468 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph = vector<vector<int>>;
#define yes (cout<<"Yes"<<endl)
#define no (cout<<"No"<<endl)
#define Endl endl
#define vi vector<int>
#define vl vector<ll>
#define vs vector<string>
#define vb vector<bool>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(v) sort(v.begin(),v.end());
#define rev(v) reverse(v.begin(),v.end());
#define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define all(a) (a).begin(), (a).end()

ll INF=9223372036800000000;
int inf=2000000000;
ll mod=998244353;
ll mod2=1000000007;
int dx[8]={-1,-1,-1,0,0,1,1,1};
int dy[8]={-1,0,1,-1,1,-1,0,1};
int dtt[4]={1,3,4,6};//dx,dyを4方向にする
ll two_billion=2000000000000;
int ohm=100000000;
string alpha="abcdefghijklmnopqrstuvwxyz";
string Alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";



int main(){
    int n,a,b;cin>>n>>a>>b;
    int ans=-1;
    vector<int> p(n);
    for(int i=0;i<n;i++)cin>>p[i];
    for(int i=0;i<n;i++){
        if(p[i]==1){
            if(a==0){
                ans=i+1;break;
            }
            a--;
        }
        if(p[i]==2){
            if(b==0){
                ans=i+1;break;
            }
            b--;
        }
        if(p[i]==3){
            if(a*b==0){
                ans=i+1;break;
            }
            a--;
            b--;
        }
    }
    cout<<ans<<Endl;
}
0