結果

問題 No.2338 Range AtCoder Query
ユーザー SSRS
提出日時 2022-08-22 06:16:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 654 bytes
コンパイル時間 1,530 ms
コンパイル使用メモリ 172,740 KB
実行使用メモリ 16,924 KB
最終ジャッジ日時 2024-10-04 09:32:05
合計ジャッジ時間 8,204 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 TLE * 1 -- * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<int> P(N);
  vector<string> S(N);
  for (int i = 0; i < N; i++){
    cin >> P[i] >> S[i];
    P[i]--;
  }
  for (int i = 0; i < Q; i++){
    int L, R;
    cin >> L >> R;
    L--;
    vector<bool> ac(M, false);
    vector<int> wa(M, 0);
    int ans1 = 0;
    int ans2 = 0;
    for (int j = L; j < R; j++){
      if (S[j] == "AC"){
        if (!ac[P[j]]){
          ans1++;
          ans2 += wa[P[j]];
          ac[P[j]] = true;
        }
      }
      if (S[j] == "WA"){
        wa[P[j]]++;
      }
    }
    cout << ans1 << ' ' << ans2 << endl;
  }
}
0