Submission #149150

# Submission time Handle Problem Language Result Execution time Memory
149150 2019-09-01T05:50:09 Z TLEWA맞(#3625, H_Squad, sungjune222, str0ct) Crosses on the Grid (FXCUP4_cross) C++17
100 / 100
224 ms 14432 KB
#include "cross.h"
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
int n;
vector<pii> arr;
multiset<int> s;
int kth;
long long SelectCross(int k, std::vector<int> I, std::vector<int> O) {
	int n = I.size();
	LL ret=0;
	for(int i=0; i<n; i++){
        arr.pb({I[i], O[i]});
	}
	sort(arr.begin(), arr.end());
	//for(int i=0; i<n; i++)printf("%d %d\n", arr[i].F, arr[i].S);
	for(int i=n-1; i>=n-k; i--){
        s.insert(arr[i].S);
	}
	multiset<int>::iterator itt=s.begin();
	ret=(LL)arr[n-k].F*((LL)(*itt)*2-(LL)arr[n-k].F);
	for(int i=n-k-1; i>=0; i--){
        multiset<int>::iterator it=s.begin();
        if(*it<arr[i].S){
            s.erase(it);
            s.insert(arr[i].S);
        }
        it=s.begin();
        ret=max(ret, (LL)arr[i].F*((LL)(*it)*2-(LL)arr[i].F));
	}
	return ret;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 128 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 12 ms 768 KB Output is correct
6 Correct 112 ms 5740 KB Output is correct
7 Correct 110 ms 5740 KB Output is correct
8 Correct 108 ms 5480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 128 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 12 ms 768 KB Output is correct
6 Correct 112 ms 5740 KB Output is correct
7 Correct 110 ms 5740 KB Output is correct
8 Correct 108 ms 5480 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 12 ms 768 KB Output is correct
13 Correct 58 ms 3184 KB Output is correct
14 Correct 105 ms 5732 KB Output is correct
15 Correct 109 ms 5736 KB Output is correct
16 Correct 114 ms 5736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 128 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 12 ms 768 KB Output is correct
6 Correct 112 ms 5740 KB Output is correct
7 Correct 110 ms 5740 KB Output is correct
8 Correct 108 ms 5480 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 12 ms 768 KB Output is correct
13 Correct 58 ms 3184 KB Output is correct
14 Correct 105 ms 5732 KB Output is correct
15 Correct 109 ms 5736 KB Output is correct
16 Correct 114 ms 5736 KB Output is correct
17 Correct 6 ms 384 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
19 Correct 16 ms 1152 KB Output is correct
20 Correct 65 ms 3308 KB Output is correct
21 Correct 91 ms 5096 KB Output is correct
22 Correct 113 ms 5740 KB Output is correct
23 Correct 111 ms 5736 KB Output is correct
24 Correct 125 ms 6624 KB Output is correct
25 Correct 194 ms 11232 KB Output is correct
26 Correct 224 ms 14432 KB Output is correct