Submission #149472

#TimeUsernameProblemLanguageResultExecution timeMemory
149472Greedy left the chat. (#200)Crosses on the Grid (FXCUP4_cross)C++17
0 / 100
6 ms384 KiB
#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 (stderr)

cross.cpp:5:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 # pragma GCC optimization ("unroll-loops")
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...