답안 #149472

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149472 2019-09-01T06:33:49 Z Greedy left the chat.(#3618, miguel, claudy, MvC) 십자가 놓기 (FXCUP4_cross) C++17
0 / 100
6 ms 384 KB
#include "cross.h"
//# pragma GCC optimize("Ofast,no-stack-protector")
//# pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
# pragma GCC optimize("Ofast")
# pragma GCC optimization ("unroll-loops")
# include "bits/stdc++.h"
/*
# include <ext/pb_ds/tree_policy.hpp>
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/rope>
*/
std::pair<int,int> DR[] = {{-1,0},{0,1},{1,0},{0,-1},{-1,1},{-1,-1},{1,1},{1,-1}};
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define rcg(s) cout << s;exit(0)
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define db(x) cerr << #x << " = " << x << '\n'
# define pb push_back
# define mp make_pair
# define all(s) s.begin(),s.end()
# define sz(x) (int)((x).size())
# define int ll
using namespace std;

# undef int
long long SelectCross(int k, std::vector<int> in, std::vector<int> out) {
# define int ll
	int n = sz(in);
	vector<pair<int,int>>vec;
	for(int i = 0;i < n;i++) vec.pb(mp(in[i],out[i]));
	int ans = 0;
	sort(vec.rbegin(),vec.rend());
	multiset<int>tr;
	for(int i = 0;i < n;i++){
		int inner = vec[i].first;
		if(sz(tr) == k - 1){
			ans = max(ans, inner * (2 * (min(*tr.begin(),vec[i].second)) - inner));
		}
		tr.insert(vec[i].second);
		if(sz(tr) >= k) tr.erase(tr.begin());
	}
	return ans;
}

Compilation message

cross.cpp:5:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 # pragma GCC optimization ("unroll-loops")
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -