Submission #921789

#TimeUsernameProblemLanguageResultExecution timeMemory
9217891075508020060209tcCake 3 (JOI19_cake3)C++14
Compilation error
0 ms0 KiB
#pragma GCC optimize("O3") //#include "meetings.h" #include<bits/stdc++.h> using namespace std; #define int long long #define X first #define Y second #define SZ(x) (int)(x).size() int K; int ksum; multiset<int>tmst; multiset<int>bmst; void mINS(int v){ tmst.insert(v); ksum+=v; if(tmst.size()>K){ ksum-=*(tmst.begin()); bmst.insert(*tmst.begin()); tmst.erase(tmst.begin()); } } void mDEL(int v){ if(bmst.find(v)!=bmst.end()){ bmst.erase(bmst.find(v)); return; } ksum-=v; tmst.erase(tmst.find(v)); if(tmst.size()<K){ if(bmst.size()){ tmst.insert(*(bmst.rbegin())); ksum+=*bmst.rbegin(); bmst.erase(prev(bmst.end())); } } } int mlit;int mrit; int n; pair<int,int>ar[200005]; int ans[200005]; vector<pair<int,int>>targ;vector<pair<int,int>>tbrg; void solve(vector<pair<int,int>>arg,vector<pair<int,int>>brg){ vector<int>apt; for(int i=0;i<arg.size();i++){ apt.push_back((arg[i].first+arg[i].second)/2); } int Q=arg.size(); mlit=n; mrit=n; mINS(ar[n].second); for(int i=Q-1;i>=0;i--){ int qmi=apt[i]; while(mlit>min(qmi-K,brg[i].second+1)){ mINS(ar[--mlit].second); } while(mrit>qmi){ mDEL(ar[mrit--].second); } int opt; ans[qmi]=-1e12; while(mlit>brg[i].first){ int cal=ar[qmi].secod-ar[qmi].first+ar[mlit-1].first+ar[mlit-1].second+ksum; if(cal>ans[qmi]){ ans[qmi]=cal; opt=mlit-1; } if(mlit-1==brg[i].first){break;} mlit--; mINS(ar[mlit].second); } } } signed main(){ cin>>n>>K; for(int i=1;i<=n;i++){ cin>>ar[i].second>>ar[i].first; ar[i].first*=2; } K-=2; sort(ar+1,ar+n+1); vector<pair<int,int>>vc;vector<pair<int,int>>vc2; vc.push_back({K+2,n}); vc2.push_back({1,n-K-3}); solve(vc,vc2); }

Compilation message (stderr)

cake3.cpp: In function 'void mINS(long long int)':
cake3.cpp:16:15: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   16 | if(tmst.size()>K){
      |    ~~~~~~~~~~~^~
cake3.cpp: In function 'void mDEL(long long int)':
cake3.cpp:29:15: warning: comparison of integer expressions of different signedness: 'std::multiset<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   29 | if(tmst.size()<K){
      |    ~~~~~~~~~~~^~
cake3.cpp: In function 'void solve(std::vector<std::pair<long long int, long long int> >, std::vector<std::pair<long long int, long long int> >)':
cake3.cpp:48:14: 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]
   48 | for(int i=0;i<arg.size();i++){
      |             ~^~~~~~~~~~~
cake3.cpp:67:25: error: 'struct std::pair<long long int, long long int>' has no member named 'secod'; did you mean 'second'?
   67 |         int cal=ar[qmi].secod-ar[qmi].first+ar[mlit-1].first+ar[mlit-1].second+ksum;
      |                         ^~~~~
      |                         second