Submission #572076

#TimeUsernameProblemLanguageResultExecution timeMemory
5720761neExhibition (JOI19_ho_t2)C++14
100 / 100
54 ms5588 KiB
#include<bits/stdc++.h>
using namespace std;
const long long mxn = 1e12;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	long long n,m;cin>>n>>m;
	vector<pair<long long ,long long>>arr(n);
	for (int i = 0;i<n;++i){
		cin>>arr[i].second>>arr[i].first;
	}
	vector<long long >brr(m);
	for (int i = 0;i<m;++i)cin>>brr[i];
	sort(brr.begin(),brr.end());
	sort(arr.begin(),arr.end());
	//find a longest subsequence that arr[j].first<=brr[i]
	int ans = m - 1;
	for (int i = n - 1;i>=0;--i){
      if (ans<0)break;
		if (arr[i].second<=brr[ans]){
			--ans;
		}
	}
	cout<<m - ans - 1<<'\n';
	return 0;
}

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:19:7: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   19 |       if (ans<0)break;
      |       ^~
joi2019_ho_t2.cpp:20:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   20 |   if (arr[i].second<=brr[ans]){
      |   ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...