# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148982 | 2019-09-01T05:30:04 Z | 갓띵건(#3694, gs18103, sjimed, gs18065) | Crosses on the Grid (FXCUP4_cross) | C++17 | 5 ms | 384 KB |
#include "cross.h" #include<bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(false);cin.tie(0) #define fi first #define se second #define eb emplace_back #define pb push_back #define all(v) (v).begin(), (v).end() #define pre(a) cout<<fixed;cout.precision(a) typedef long long ll; typedef pair<int,int> pii; typedef pair<ll, ll> pll; const int inf = 1e9; const ll INF = 1e18; priority_queue<int> pQ; vector<pii> v; long long SelectCross(int K, std::vector<int> I, std::vector<int> O) { int n = I.size(); for(int i=0; i<n; i++) { v.eb(I[i], O[i]); } sort(all(v)); ll ans = 0; for(int i=n-1; i >= 0; i--) { if(pQ.size() == K-1) { ll out = min(v[i].se, -pQ.top()); ll in = v[i].fi; ans = max(ans, 2 * out * in - in * in); } if(pQ.size() < K-1) pQ.push(-v[i].se); else if(pQ.size() && -pQ.top() < v[i].se) pQ.pop(), pQ.push(-v[i].se); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |