結果

問題 No.145 yukiover
ユーザー kosakkunkosakkun
提出日時 2016-12-27 17:46:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,515 bytes
コンパイル時間 964 ms
コンパイル使用メモリ 92,108 KB
実行使用メモリ 4,512 KB
最終ジャッジ日時 2023-08-21 14:57:50
合計ジャッジ時間 1,937 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 4 ms
4,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 4 ms
4,380 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 4 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

int main(){
   
    int N; string S;
    cin>>N>>S;
    
    int cnt[26]={};
    REP(i,S.size())cnt[S[i]-'a']++;
    
    int ans=cnt[25];
    for(int i='v'-'a';i<='x'-'a';i++){
        ans+=min(cnt[i],cnt[24]);
        cnt[24]-=min(cnt[24],cnt[i]);
    }
    
    cnt['u'-'a']=min(cnt['y'-'a'],cnt['u'-'a']);
    for(int i='l'-'a';i<='t'-'a';i++){
        ans+=min(cnt[i],cnt['u'-'a']);
        cnt['u'-'a']-=min(cnt['u'-'a'],cnt[i]);
    }
    
    cnt['k'-'a']=min(cnt['u'-'a'],cnt['k'-'a']);
    ans+=min(cnt['k'-'a'],cnt['j'-'a']);
    
    cnt['i'-'a']=min(cnt['k'-'a'],cnt['i'-'a']);
    int sum=0;
    REP(i,'i'-'a')sum+=cnt[i];
    
    ans+=min(cnt['i'-'a'],sum);
    
    cout<<ans<<endl;
    
    return 0;
}
0