日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

E. Stupid Submissions(思维)

發布時間:2023/12/14 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 E. Stupid Submissions(思维) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

滴答滴答---題目鏈接?

E. Stupid Submissions

time limit per test

1.5 s

memory limit per test

256 MB

input

standard input

output

standard output

Abed is so motivated this year, his goal is qualifying for the 2019 ACM International Collegiate Programming Contest (ACM ICPC). Therefore, he always trains using Codeforces online judge. If you do not know Codeforces, the following rules can help you to understand how it works:

  • Each problem has a set of?n?tests numbered from?1?to?n. The first?k?tests are called sample tests. These tests are visible in the problem statement and a user can see them all.
  • When Abed gets a wrong answer on test?x?(x?≤?n), he can see all the tests up to test number?x. If Abed gets accepted, he can see all the tests.
  • Each test can be either small or big. Abed can see the entire test only if it is small. If the test is big, Abed can see it partially. All the sample tests are small.

For example, let us consider a problem contains?6?tests, in which the first two tests are the sample tests. If Abed got a wrong answer on test?4, a wrong answer on test?3, and a wrong answer on test?5, he can see all tests from?1?to?5. If test?3?is small and the tests from?4?to?6are big, Abed can see the first three tests fully, but he cannot fully see the remaining tests.

Unfortunately, Abed usually gets a lot of wrong answers. A submission made by Abed is called stupid if he got a wrong answer on a small test that he can see it fully. You are given a list of submissions made be Abed, your task is to count how many stupid submission Abed has made. Can you?

Input

The first line contains an integer?T?(1?≤?T?≤?100) specifying the number of test cases.

The first line of each test case contains three integers?n,?m, and?k?(1?≤?k?≤?n?≤?104,?1?≤?m?≤?104), in which?n?is the number of tests in the problem,?m?is the number of submissions Abed has made, and?k?is the number of sample tests. Then a line follow contains?n?characters?t1,?...,?tn, in which?ti?is 'S' if the?ith?test is small, and 'B' if it is big.

Then?m?lines follow, giving the list of submissions Abed has made, such that the?ith?line will either contain a single character 'A' if Abed got accepted on the?ith?submission, or contain a character 'W' and an integer?x?(1?≤?x?≤?n) giving that Abed got a wrong answer on test case?x.

Output

For each test case, print a single line containing the number of stupid submissions Abed has made.

Example

input

Copy

2 5 4 2 S S B S B W 3 W 4 W 4 A 4 3 2 S S B B W 1 W 2 W 3

output

Copy

1 2 #include<bits/stdc++.h> using namespace std; int s[10001]; int main() {int t;scanf("%d",&t);while(t--){int n,m,a,b;char x[5];scanf("%d%d%d",&n,&m,&a);for(int i=1; i<=n; i++){scanf("%s",x);if(x[0]=='S')s[i]=0;else s[i]=1;}int ans=0;for(int i=0; i<m; i++){scanf("%s",x);if(x[0]=='W'){scanf("%d",&b);if(s[b]==0){if(b<=a)ans++;}a=max(a,b);}else if(x[0]=='A')a=n;}printf("%d\n",ans);}return 0; }

?

總結

以上是生活随笔為你收集整理的E. Stupid Submissions(思维)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。