結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-24 10:46:36 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 686 bytes |
| コンパイル時間 | 2,068 ms |
| コンパイル使用メモリ | 196,104 KB |
| 最終ジャッジ日時 | 2025-01-09 10:01:09 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
#include<bits/stdc++.h>
using lint=long long;
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
std::vector<lint>a(3),b(3);
for(lint&x:a)std::cin>>x;
std::string s;std::cin>>s;
for(char c:s){
if(c=='G')b.at(0)++;
if(c=='C')b.at(1)++;
if(c=='P')b.at(2)++;
}
lint ans=0;
for(lint i=0;i<3;i++){
lint j=(i+1)%3;
lint x=std::min(a.at(i),b.at(j));
ans+=3*x;
a.at(i)-=x;
b.at(j)-=x;
}
for(lint i=0;i<3;i++){
lint x=std::min(a.at(i),b.at(i));
ans+=x;
}
std::cout<<ans<<'\n';
}
ngtkana