이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pll;
#define fastio ios::sync_with_stdio(false), cin.tie(0)
// #pragma GCC optimize("Ofast")
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define lowbit(x) x&-x
const int maxn = 3000 + 5;
const int INF = 1e9;
const double eps = 1e-7;
struct info{
int s, v;
info(){}
info(int _s, int _v) : s(_s), v(_v){}
bool operator < (const info& other) const{
return v < other.v || (v == other.v && s < other.s);
}
};
int main(void){
fastio;
int n, m;
cin>>n>>m;
vector<info> a(n);
for(int i = 0; i < n; i++){
int s, v;
cin>>s>>v;
a[i] = info(s, v);
}
vector<int> c(m);
for(int i = 0; i < m; i++) cin>>c[i];
sort(c.begin(), c.end());
int ans = 0, cur = m - 1;
sort(a.begin(), a.end());
for(int i = n - 1; i >= 0; i--){
if(cur < 0) break;
if(c[cur] >= a[i].s) ans++, cur--;
}
cout<<ans<<"\n";
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |