# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
150241 | 2019-09-01T07:57:53 Z | 요까할 로뭘 은명팀(#3558, mario05092929, foja001, earthk) | Crosses on the Grid (FXCUP4_cross) | C++17 | 229 ms | 16092 KB |
#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; int a[200005]; multiset <int> s; bool cmp(pll p1,pll p2) { if(p1.first == p2.first) return p1.second > p2.second; else return p1.first > p2.first; } bool cmp2(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()); ll oo = 1e10,ii = 1e10,ans = 0; for(int i = n-k;i < n;i++) s.insert(v[i].second); auto it = s.begin(); ans = v[n-k].first*(2*(*it)-v[n-k].first); //cout << ans << " " << *it << " " << v[n-k].first << '\n'; for(int i = n-k-1;i >= 0;i--) { s.insert(v[i].second); it = s.begin(); s.erase(it); it = s.begin(); ans = max(ans,v[i].first*(2*(*it)-v[i].first)); //cout << ans << " "; } //return ii*(2*oo-ii); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 6 ms | 256 KB | Output is correct |
5 | Correct | 12 ms | 1024 KB | Output is correct |
6 | Correct | 125 ms | 7780 KB | Output is correct |
7 | Correct | 126 ms | 7652 KB | Output is correct |
8 | Correct | 119 ms | 7780 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 6 ms | 256 KB | Output is correct |
5 | Correct | 12 ms | 1024 KB | Output is correct |
6 | Correct | 125 ms | 7780 KB | Output is correct |
7 | Correct | 126 ms | 7652 KB | Output is correct |
8 | Correct | 119 ms | 7780 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 6 ms | 256 KB | Output is correct |
12 | Correct | 13 ms | 1024 KB | Output is correct |
13 | Correct | 66 ms | 4204 KB | Output is correct |
14 | Correct | 123 ms | 7780 KB | Output is correct |
15 | Correct | 125 ms | 7780 KB | Output is correct |
16 | Correct | 125 ms | 7828 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 6 ms | 256 KB | Output is correct |
5 | Correct | 12 ms | 1024 KB | Output is correct |
6 | Correct | 125 ms | 7780 KB | Output is correct |
7 | Correct | 126 ms | 7652 KB | Output is correct |
8 | Correct | 119 ms | 7780 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 6 ms | 256 KB | Output is correct |
12 | Correct | 13 ms | 1024 KB | Output is correct |
13 | Correct | 66 ms | 4204 KB | Output is correct |
14 | Correct | 123 ms | 7780 KB | Output is correct |
15 | Correct | 125 ms | 7780 KB | Output is correct |
16 | Correct | 125 ms | 7828 KB | Output is correct |
17 | Correct | 5 ms | 384 KB | Output is correct |
18 | Correct | 6 ms | 512 KB | Output is correct |
19 | Correct | 16 ms | 1404 KB | Output is correct |
20 | Correct | 70 ms | 4204 KB | Output is correct |
21 | Correct | 97 ms | 7140 KB | Output is correct |
22 | Correct | 131 ms | 7784 KB | Output is correct |
23 | Correct | 127 ms | 7828 KB | Output is correct |
24 | Correct | 143 ms | 8156 KB | Output is correct |
25 | Correct | 206 ms | 12892 KB | Output is correct |
26 | Correct | 229 ms | 16092 KB | Output is correct |