제출 #817245

#제출 시각아이디문제언어결과실행 시간메모리
817245tolbi카니발 티켓 (IOI20_tickets)C++17
0 / 100
1 ms308 KiB
#pragma optimize("Bismillahirrahmanirrahim") //█▀█─█──█──█▀█─█─█ //█▄█─█──█──█▄█─█■█ //█─█─█▄─█▄─█─█─█─█ //Allahuekber //ahmet23 orz... //Sani buyuk Osman Pasa Plevneden cikmam diyor. //FatihSultanMehmedHan //YavuzSultanSelimHan //AbdulhamidHan #define author tolbi #include <bits/stdc++.h> using namespace std; template<typename X, typename Y> istream& operator>>(istream& in, pair<X,Y> &pr) {return in>>pr.first>>pr.second;} template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr) {return os<<pr.first<<" "<<pr.second;} template<typename X> istream& operator>>(istream& in, vector<X> &arr) {for(auto &it : arr) in>>it; return in;} template<typename X> ostream& operator<<(ostream& os, vector<X> arr) {for(auto &it : arr) os<<it<<" "; return os;} template<typename X, size_t Y> istream& operator>>(istream& in, array<X,Y> &arr) {for(auto &it : arr) in>>it; return in;} template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> arr) {for(auto &it : arr) os<<it<<" "; return os;} template<typename T> vector<int32_t> normalize(vector<T> &arr){vector<int32_t> rv;rv.resize(arr.size());for (int i = 0; i < rv.size(); ++i){rv[i]=arr[i];}return rv;} #define endl '\n' #define vint(x) vector<int> x #define deci(x) int x;cin>>x; #define decstr(x) string x;cin>>x; #define cinarr(x) for (auto &it : x) cin>>it; #define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl; #define sortarr(x) sort(x.begin(),x.end()) #define sortrarr(x) sort(x.rbegin(),x.rend()) #define det(x) cout<<"NO\0YES"+x*3<<endl; #define INF LONG_MAX #define rev(x) reverse(x.begin(),x.end()); #define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define tol(bi) (1LL<<((int)(bi))) const int MOD = 1e9+7; mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count()); typedef long long ll; #include "tickets.h" long long find_maximum(int32_t k, vector<vector<int32_t>> arr) { int n = arr.size(); int m = arr[0].size(); ll somma1 = 0; ll somma2 = 0; int top1 = 0; int top2 = 0; for (int i = 0; i < n; i++){ sortarr(arr[i]); for (int j = 0; j < k; j++){ somma1+=arr[i][m-j-1]; top1++; } } priority_queue<pair<ll,pair<int,int>>,vector<pair<ll,pair<int,int>>>,greater<pair<ll,pair<int,int>>>> pq; priority_queue<pair<ll,pair<int,int>>,vector<pair<ll,pair<int,int>>>,greater<pair<ll,pair<int,int>>>> pq2; ll alsum = 0; int ara = m-k; for (int i = 0; i < n; i++){ pq.push({arr[i][0],{i,0}}); } ll ans = 0; int hedtop2 = k*((n+1)/2); vector<int> cnt(n,0); while (pq.size()){ ll val = pq.top().first; int x = pq.top().second.first; int y = pq.top().second.second; pq.pop(); if (y==k) continue; if (y+1<k) pq.push({arr[x][y+1],{x,y+1}}); cnt[x]++; somma1-=arr[x][y+ara]; top1--; somma2+=arr[x][y]; top2++; pq2.push({val,{x,y}}); alsum+=val; while (pq2.size()>k) alsum-=pq2.top().first,pq2.pop(); if (pq.size()<k) continue; if (top2!=hedtop2) continue; ans=max(ans,alsum*top2-somma2+somma1-alsum*top1); } vector<vector<int>> rval(n,vector<int>(m,-1)); int ind = 0; while (pq2.size()){ rval[pq2.top().second.first][pq2.top().second.second]=ind++; pq2.pop(); } allocate_tickets(rval); //k=1 pass vector<int> kal(k,n-1); return ans; }

컴파일 시 표준 에러 (stderr) 메시지

tickets.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      | 
tickets.cpp: In function 'long long int find_maximum(int32_t, std::vector<std::vector<int> >)':
tickets.cpp:77:20: warning: comparison of integer expressions of different signedness: 'std::priority_queue<std::pair<long long int, std::pair<int, int> >, std::vector<std::pair<long long int, std::pair<int, int> > >, std::greater<std::pair<long long int, std::pair<int, int> > > >::size_type' {aka 'long unsigned int'} and 'int32_t' {aka 'int'} [-Wsign-compare]
   77 |   while (pq2.size()>k) alsum-=pq2.top().first,pq2.pop();
      |          ~~~~~~~~~~^~
tickets.cpp:78:16: warning: comparison of integer expressions of different signedness: 'std::priority_queue<std::pair<long long int, std::pair<int, int> >, std::vector<std::pair<long long int, std::pair<int, int> > >, std::greater<std::pair<long long int, std::pair<int, int> > > >::size_type' {aka 'long unsigned int'} and 'int32_t' {aka 'int'} [-Wsign-compare]
   78 |   if (pq.size()<k) continue;
      |       ~~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...