#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
struct pic{
ll v,s;
bool operator <(const pic& rhs) const{
return v < rhs.v;
}
};
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n,m;
cin >> n >> m;
vector <pic> arr(n);
for (int z=0;z<n;z++){
cin >> arr[z].s >> arr[z].v;
}
vector <ll> frame(m);
for (int z=0;z<m;z++){
cin >> frame[z];
}
sort(arr.begin(),arr.end());
sort(frame.begin(),frame.end());
ll i = 0;
ll ans = 0;
for (int z=0;z<m;z++){
ll i = z;
ll c = 0;
for (int x=0;x<n && i < m;x++){
while (i < m && arr[x].s > frame[i]){
i++;
}
if (i == m) break;
c++;
i++;
}
ans = max(ans,c);
}
cout << ans << endl;
}
Compilation message
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:38:8: warning: unused variable 'i' [-Wunused-variable]
ll i = 0;
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |