Submission #149794

# Submission time Handle Problem Language Result Execution time Memory
149794 2019-09-01T07:10:36 Z (대충 적당한 팀명)(#3621, rose0310, cos18, baikdohyup) Crosses on the Grid (FXCUP4_cross) C++17
8 / 100
102 ms 5096 KB
#include "cross.h"
#include <algorithm>

long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
	int N = I.size();
	long long maxsize = 0;
	std::vector<int> cha;
	for(int i=0;i<N;i++){
		cha.push_back(O[i]-I[i]);
	}
	if(K==1){
		for(int i=0;i<N;i++){
			long long now = (long long)O[i]*(long long)O[i] - (long long)cha[i]*(long long)cha[i];
			maxsize = (maxsize>now)?maxsize:now;
		}
	} else{
		std::vector<std::pair<int, int>> p;
		for(int i=0;i<N;i++){
			p.push_back(std::make_pair(O[i], cha[i]));
		}
		std::sort(p.begin(), p.end());
		maxsize = (long long)p[K-1].first*(long long)p[K-1].first - (long long)p[K-1].second*(long long)p[K-1].second;
	}	
	return maxsize;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 13 ms 640 KB Output is correct
6 Correct 102 ms 4968 KB Output is correct
7 Correct 91 ms 5096 KB Output is correct
8 Correct 90 ms 5096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 13 ms 640 KB Output is correct
6 Correct 102 ms 4968 KB Output is correct
7 Correct 91 ms 5096 KB Output is correct
8 Correct 90 ms 5096 KB Output is correct
9 Incorrect 6 ms 384 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 13 ms 640 KB Output is correct
6 Correct 102 ms 4968 KB Output is correct
7 Correct 91 ms 5096 KB Output is correct
8 Correct 90 ms 5096 KB Output is correct
9 Incorrect 6 ms 384 KB Output isn't correct
10 Halted 0 ms 0 KB -