1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| #include <bits/stdc++.h>
using namespace std;
map<string,int> action = {{"1B",1},{"2B",2},{"3B",3},{"HR",4},{"FO",5},{"GO",5},{"SO",5}};
signed main(){ queue<string> player[11]; queue<bool> base; base.push(0),base.push(0),base.push(0); int out, cur_out = 0, score=0; for(int i = 0,n; i<9; i++){ cin >> n; string tmp; for(int j=0; j < n; j++) cin>>tmp, player[i].push(tmp); } cin >> out; bool clear=0; for(int cur_pl = 0; out!=cur_out; cur_pl=(cur_pl+1)%9){ if(clear){ for(int i = 0; i<3; i++) base.pop(),base.push(0); clear=0; } int cmd = action[player[cur_pl].front()]; player[cur_pl].pop(); if(cmd==5) cur_out++, clear=!(cur_out%3); else{ base.push(1),score+=base.front(),base.pop(); for(int i = 0; i<cmd-1; i++) score+=base.front(),base.pop(),base.push(0); } } cout << score << '\n'; return 0; }
|