結果
| 問題 | No.3085 Easy Problems |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-01-03 22:23:10 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 813 ms / 2,000 ms |
| コード長 | 983 bytes |
| 記録 | |
| コンパイル時間 | 1,995 ms |
| コンパイル使用メモリ | 225,464 KB |
| 実行使用メモリ | 16,192 KB |
| 最終ジャッジ日時 | 2026-01-03 22:23:38 |
| 合計ジャッジ時間 | 24,228 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 31 |
ソースコード
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include <debug.hpp>
#else
#define debug(...) 42
#endif
using namespace std;
#define int long long
void solve(){
int n;
cin>>n;
map<int,vector<int>> data;
vector<int> st;
for(int i=0;i<n;++i){
int a,b;
cin>>a>>b;
--b;
st.push_back(a);
data[b].push_back(a);
}
for(auto &[a,b]: data){
sort(b.begin(), b.end());
}
sort(st.begin(), st.end());
int q;
cin>>q;
while(q--){
int a, b;
cin>>a>>b;
--b;
int ind = upper_bound(data[b].begin(), data[b].end(), a) - data[b].begin();
int temp2 = upper_bound(st.begin(), st.end(), a)-st.begin() ;
int ans = temp2-ind;
cout<<ans<<endl;
}
}
int32_t main(){
ios::sync_with_stdio(false); cin.tie(nullptr);
int t = 1;
// cin>>t;
int x = 1;
while(t--){
debug(x);
++x;
solve();
}
return 0;
}
vjudge1