Submission #149479

#TimeUsernameProblemLanguageResultExecution timeMemory
149479요까할 로뭘 은명팀 (#200)Crosses on the Grid (FXCUP4_cross)C++17
0 / 100
5 ms384 KiB
#include "cross.h" #include <bits/stdc++.h> #define pll pair<long long,long long> using namespace std; typedef long long ll; vector <pll> v; int n; bool cmp(pll p1,pll p2) { if(p1.second == p2.second) return p1.first > p2.first; else return p1.second > p2.second; } long long SelectCross(int k,vector<int> I,vector<int> O) { n = I.size(); for(int i = 0;i < n;i++) v.push_back(make_pair((ll)I[i],(ll)O[i])); sort(v.begin(),v.end(),cmp); ll oo = 1e10,ii = 1e10,ans = 0; for(int i = 0;i < n;i++) { ans = max(ans,v[i].second*(v[i].second-2)+2*v[i].first); ii = min(ii,v[i].first); oo = min(oo,v[i].second); } //return oo*(oo-2)+2*ii; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...