# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
492886 |
2021-12-09T14:09:58 Z |
Biaz |
Exhibition (JOI19_ho_t2) |
C++17 |
|
1 ms |
332 KB |
#include <bits/stdc++.h>
#define int long long
//#define double long double
#define Nanase_Kurumi_aka_menhera_chan_is_mine ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pi pair<int, int>
#define ALL(i) i.begin(),i.end()
#define gcd(i,j) __gcd(i,j)
#define fi first
#define se second
#define eps 0.00000001
#define ist insert
#define DNE nullptr
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC optimize("O2")
int max(int x,int y){return x>=y?x:y;}
int min(int x,int y){return x>=y?y:x;}
using namespace std;
typedef int ll;
const int N=100005;
const int M=1000005;
const int MOD=1000000007;//998244353;
const int INF=1000000000000000000;//2147483647;
pi a[N];
int c[N],bit[N];
int n,m;
/*void add(int i,int v){
while (i<N){
bit[i]+=v;
i+=(i&-i);
}
}
int que(int i){
int res=0;
while (i>0){
res+=bit[i];
i-=(i&-i);
}
return res;
}
int n,m;
int getlocate(int v){
int l=1,r=m,res=0;
while (r>=l){
int md=(l+r)/2;
if (c[md]>=v){
res=md;
l=md+1;
}
else r=md-1;
}
return res;
}*/
int calc(int k){
vector<int> vc;
for (int i=0;(1<<i)<=k;i++)
if (k&i)
vc.pb(i+1);
reverse(ALL(vc));
for (int i=0;i<vc.size();i++)
if (c[i]<a[vc[i]].se)
return 0;
return vc.size();
}
inline void sol(){
cin >>n>>m;
for (int i=1;i<=n;i++)
cin >>a[i].se>>a[i].fi;
for (int j=0;j<m;j++)
cin >>c[j];
sort(a+1,a+n+1);
sort(c,c+m,greater<int>());
int ans=0;
for (int i=0;i<(1<<n);i++){
ans=max(ans,calc(i));
}
cout <<ans<<'\n';
}
signed main(){
Nanase_Kurumi_aka_menhera_chan_is_mine
int _=1;
//cin >>_;
while (_--) sol();
return 0;
}
Compilation message
joi2019_ho_t2.cpp: In function 'long long int calc(long long int)':
joi2019_ho_t2.cpp:61:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
61 | for (int i=0;i<vc.size();i++)
| ~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |