Submission #167360

#TimeUsernameProblemLanguageResultExecution timeMemory
167360theStaticMindExhibition (JOI19_ho_t2)C++14
0 / 100
2 ms376 KiB
#include<bits/stdc++.h> #define mp make_pair #define pb push_back #define ii pair<int,int> #define all(x) (x).begin(),(x).end() #define INF 100000000000000000 #define modulo 1000000007 #define mod 998244353 #define int long long int using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); // freopen("q.gir","r",stdin); // freopen("q.cik","w",stdout); int n,m,ans=0,mx=INF; cin>>n>>m; map<int,vector<ii>>arr; map<int,set<int>>Q; for(int i=0;i<n;i++){ int x,y; cin>>x>>y; arr[x].pb({y,i+1}); Q[y].insert(i+1); } for(int i=0;i<m;i++){ int x; cin>>x; arr[x].pb({0,0}); } for(map<int,vector<ii>>::reverse_iterator itr=arr.rbegin();itr!=arr.rend();itr++){ vector<ii>&W=itr->second; for(int i=0;i<W.size();i++){ if(W[i].second==0&&!Q.empty()){ Q.rbegin()->second.erase(--Q.rbegin()->second.end()); if(Q.rbegin()->second.empty())Q.erase(--Q.end()); ans++; } } for(int i=0;i<W.size();i++){ if(W[i].second){ Q[W[i].first].erase(W[i].second); if(Q[W[i].first].empty())Q.erase(W[i].first); } } } cout<<ans; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int32_t main()':
joi2019_ho_t2.cpp:34:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int i=0;i<W.size();i++){
                         ~^~~~~~~~~
joi2019_ho_t2.cpp:41:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int i=0;i<W.size();i++){
                         ~^~~~~~~~~
joi2019_ho_t2.cpp:17:21: warning: unused variable 'mx' [-Wunused-variable]
       int n,m,ans=0,mx=INF;
                     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...