This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define FileName "test"
#define ll long long
#define ld long double
#define ull unsigned long long
#define Debug(x) cerr << #x << "is " << x << '\n';
#define pb emplace_back
#define mp make_pair
#define x first
#define y second
//#define LuckyAurora
//#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
template<typename T> inline void Cin(T &x)
{
char c;
T sign = 1;
x = 0;
for (c = getchar(); c < '0' || c > '9'; c = getchar())
if (c == '-') sign = -1;
for (; c >= '0' && c <= '9'; c = getchar())
x = x * 10 + c - '0';
x *= sign;
}
template <typename T> inline void Out(T x) {if(x > 9) Out(x / 10); putchar(x % 10 + '0');}
template <typename T> inline void Cout(T x, char c) {if(x < 0) putchar('-'); x = abs(x); Out(x); putchar(c);}
template <typename T, typename... Args> inline void Cin(T& a, Args&... args) {Cin(a);Cin(args...);}
template <typename T, typename... Args> inline void Cout(T a, char c, Args... args) {Cout(a, c);Cout(args...);}
typedef pair<int, int> pii;
const int N = int(1e5) + 1;
const int logN = 60;
int n, m, fr[N], res;
struct TIrene{int s, v;} a[N];
void Enter()
{
cin >> n >> m;
for(int i = 0; i < n; ++i) cin >> a[i].s >> a[i].v;
for(int i = 0; i < m; ++i) cin >> fr[i];
sort(fr, fr + m, greater<int>());
sort(a, a + n, [](const TIrene& a, const TIrene& b) {
return a.v > b.v || (a.v == b.v && a.s > b.s);
});
}
void Solve()
{
int j = 0;
for(int i = 0; i < m; ++i) {
while(a[j].s > fr[i] && j < n) ++j;
if(j < n) ++res, ++j;
}
cout << res;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
if(fopen(FileName".inp", "r")) {
freopen(FileName".inp", "r", stdin);
freopen(FileName".out", "w", stdout);
}
/*int nTest; cin >> nTest;
while(nTest --)*/ Enter(), Solve();
return 0;
}
Compilation message (stderr)
joi2019_ho_t2.cpp:13:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
#pragma GCC optimization ("O3")
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:68:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
freopen(FileName".inp", "r", stdin);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:69:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
freopen(FileName".out", "w", stdout);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |