Submission #227364

# Submission time Handle Problem Language Result Execution time Memory
227364 2020-04-27T07:12:19 Z bharat2002 Exhibition (JOI19_ho_t2) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
const int N=1e5 + 100;
#define int long long
#define pii pair<int, int>
#define f first
#define s second 
//Trace prints the name of the variable and the value.
int n, m, arr[N];
struct comp
{
	bool operator()(pii a, pii b)
	{
		if(a.f==b.f) return a.s<=b.s;return a.f<b.f;
	}
};
priority_queue< pii, vector< pii>, comp > pq;
bool sf(int a, int b)
{
	return a>b;
}
signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		int ss, v;cin>>ss>>v;pq.push(mp(v, ss));
	}
	for(int i=1;i<=m;i++) cin>>arr[i];
	sort(arr+1, arr+m+1, sf);;
	int ans=0;
	for(int i=1;i<=m;i++)
	{
		while(!pq.empty()&&pq.top().s>arr[i]) pq.pop();
		if(pq.empty()) break;
		ans++;pq.pop();
	}
	cout<<ans;
}

Compilation message

joi2019_ho_t2.cpp: In member function 'bool comp::operator()(std::pair<long long int, long long int>, std::pair<long long int, long long int>)':
joi2019_ho_t2.cpp:14:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   if(a.f==b.f) return a.s<=b.s;return a.f<b.f;
   ^~
joi2019_ho_t2.cpp:14:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   if(a.f==b.f) return a.s<=b.s;return a.f<b.f;
                                ^~~~~~
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:28:32: error: 'mp' was not declared in this scope
   int ss, v;cin>>ss>>v;pq.push(mp(v, ss));
                                ^~
joi2019_ho_t2.cpp:28:32: note: suggested alternative: 'm'
   int ss, v;cin>>ss>>v;pq.push(mp(v, ss));
                                ^~
                                m