이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define TASKNAME "codeforce"
#define pb push_back
#define pli pair<int,int>
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
using ll=long long;
const ll maxN=2e5;
const ll inf=1e18;
const ll mod=1e9+7;
ll n,m;
pli a[maxN];
ll b[maxN];
void solve()
{
cin >> n >> m;
for(int i=1;i<=n;i++) cin >> a[i].se >> a[i].fi;
sort(a+1,a+n+1);
for(int i=1;i<=m;i++)
{
cin >> b[i];
}
sort(b+1,b+m+1);
ll low=0,high=m;
while(low<=high)
{
ll mid=low+high>>1;
ll j=m-mid+1;
for(int i=1;i<=n;i++)
{
if(j<=m&&a[i].se<=b[j])
{
j++;
}
}
if(j==m+1) low=mid+1;
else high=mid-1;
}
cout << high;
}
int main()
{
fastio
//freopen(TASKNAME".INP","r",stdin);
//freopen(TASKNAME".OUT","w",stdout);
solve();
}
컴파일 시 표준 에러 (stderr) 메시지
joi2019_ho_t2.cpp: In function 'void solve()':
joi2019_ho_t2.cpp:29:19: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
29 | ll mid=low+high>>1;
| ~~~^~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |