結果

問題 No.3085 Easy Problems
コンテスト
ユーザー vjudge1
提出日時 2026-01-03 17:37:34
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 1,024 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,904 ms
コンパイル使用メモリ 354,452 KB
実行使用メモリ 25,016 KB
最終ジャッジ日時 2026-01-03 17:37:56
合計ジャッジ時間 20,844 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// Source: https://usaco.guide/general/io
//who needs macros when you have usaco
#include <bits/stdc++.h>
using namespace std;
#define int long long

#define fastnuces ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int t = 1;



void solve(){
	int n;
    cin>>n;
    vector<pair<int,int>>a(n);
    vector<array<int,3>>query;
    for(int i=0;i<n;++i){
        int x,y;
        cin>>x>>y;
        query.push_back({x,-1,y});
    }



    int q;
    cin>>q;
    int id=0;
    for(int i=0;i<q;++i){
        int x,y;
        cin>>x>>y;
        query.push_back({x,i,y});
    }
    sort(query.begin(),query.end());    

    int pref=0;
    map<int,int>freq;
    vector<int>ans(q);
    for(auto [x,id,y]:query){

        if(id!=-1){
            ans[id] = pref-freq[y];
        }
        else{
            freq[y]++;
            pref++;
        }
    }

    for(int i:ans)cout<<i<<endl;
    cout<<endl;
    
}

signed main(){

    fastnuces;
   // for(int i=100;i>=1;--i)dfs(i);
    //cin>>t;

    while(t--){
        solve();
    }
}
0