結果

問題 No.3085 Easy Problems
ユーザー t98slider
提出日時 2025-04-04 22:15:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 670 bytes
コンパイル時間 2,234 ms
コンパイル使用メモリ 205,764 KB
実行使用メモリ 14,260 KB
最終ジャッジ日時 2025-04-04 22:15:24
合計ジャッジ時間 9,425 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 4 WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<tuple<int,int,int>> a(n);
    for(auto &&[x, y, z] : a){
        cin >> x >> y;
        z = -1;
    }
    int Q;
    cin >> Q;
    for(int i = 0; i < Q; i++){
        int x, y;
        cin >> x >> y;
        a.emplace_back(x, y, i);
    }
    sort(a.begin(), a.end());
    int tot = 0;
    vector<int> ans(Q), cnt(100001);
    for(auto &&[x, y, z] : a){
        if(z == -1){
            cnt[y]++;
            tot++;
        }else{
            ans[z] = tot - cnt[y];
        }
    }
    for(auto &&v : ans) cout << v << '\n';
}
0