結果

問題 No.3085 Easy Problems
ユーザー tobbie
提出日時 2025-04-05 17:24:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 574 bytes
コンパイル時間 2,084 ms
コンパイル使用メモリ 169,688 KB
実行使用メモリ 32,804 KB
最終ジャッジ日時 2025-04-05 17:25:01
合計ジャッジ時間 7,909 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other TLE * 1 -- * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
int main() {
  int n;
  cin >> n;
  map<int, vector<int>> problem;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    problem[a].push_back(b);
  }
  int q;
  cin >> q;
  rep(i, q) {
    int x, y;
    cin >> x >> y;
    int ans = 0;
    for (auto it = problem.begin(); it != problem.end() && it->first <= x; it++) {
      int tmp = 0;
      rep(j, (int)(it->second.size()))
	  if ((it->second)[j] != y) tmp++;
      ans += tmp;
    }
    cout << ans << endl;
  }
  return 0;
}
0