# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
721004 |
2023-04-10T03:34:24 Z |
pcc |
Exhibition (JOI19_ho_t2) |
C++14 |
|
0 ms |
212 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define pll pair<ll,ll>
#define fs first
#define sc second
const ll mxn = 1e5+10;
main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll n,m;
cin>>n>>m;
pll arr[n];
for(auto &i:arr)cin>>i.fs>>i.sc;
ll brr[m];
for(auto &i:arr)i.fs = -i.fs,i.sc = -i.sc;
for(auto &i:brr)cin>>i;
for(auto &i:brr)i = -i;
sort(arr,arr+n);
sort(brr,brr+m);
vector<pll> b;
for(auto &i:brr){
if(b.empty()||b.back().fs != i)b.push_back({i,1});
else b.back().sc++;
}
vector<ll> lis;
ll len = 0;
ll p = 0;
b.push_back({0,0});
while(p<n&&arr[p].fs<b[0].fs)p++;
for(int i = 0;i<b.size()-1;i++){
auto tmp = b[i];
len += tmp.sc;
vector<int> v;
while(p<n&&arr[p].fs<b[i+1].fs){
v.push_back(arr[p].sc);
p++;
}
sort(v.begin(),v.end());
for(auto &j:v){
auto pos = upper_bound(lis.begin(),lis.end(),j)-lis.begin();
if(pos == lis.size())lis.push_back(j);
else lis[pos] = j;
}
while(lis.size()>len)lis.pop_back();
//for(auto &j:lis)cout<<j<<' ';cout<<endl;
}
/*
for(auto &i:b)cout<<i.fs<<' '<<i.sc<<',';cout<<endl;
for(auto &i:arr)cout<<i.fs<<' '<<i.sc<<',';cout<<endl;
*/
cout<<lis.size();
return 0;
}
Compilation message
joi2019_ho_t2.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
11 | main(){
| ^~~~
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:33:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | for(int i = 0;i<b.size()-1;i++){
| ~^~~~~~~~~~~
joi2019_ho_t2.cpp:44:11: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | if(pos == lis.size())lis.push_back(j);
| ~~~~^~~~~~~~~~~~~
joi2019_ho_t2.cpp:47:19: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
47 | while(lis.size()>len)lis.pop_back();
| ~~~~~~~~~~^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |