Submission #149413

#TimeUsernameProblemLanguageResultExecution timeMemory
149413Greedy left the chat. (#200)Crosses on the Grid (FXCUP4_cross)C++17
Compilation error
0 ms0 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; using namespace __gnu_pbds; using namespace __gnu_cxx; template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; Tree<int>tr; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # define LOCAL # define sim template < class c # define ris return * this # define dor > debug & operator << # define eni(x) sim > typename \ enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) { sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...); struct debug { #ifdef LOCAL ~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; } #else sim dor(const c&) { ris; } #endif }; #define show(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] " int gcd(int a, int b) { if(b) return gcd(b,a%b); return a; }mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 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()); for(int i = 0;i < n;i++){ int inner = vec[i].first; tr.insert(vec[i].second); if(sz(tr) >= k){ ans = max(ans, inner * (2 * tr.find_by_order(sz(tr) - k) - inner); } } return ans; }

Compilation message (stderr)

cross.cpp:5:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 # pragma GCC optimization ("unroll-loops")
 
cross.cpp:27:17: error: '__gnu_pbds' is not a namespace-name
 using namespace __gnu_pbds;
                 ^~~~~~~~~~
cross.cpp:27:27: error: expected namespace-name before ';' token
 using namespace __gnu_pbds;
                           ^
cross.cpp:29:33: error: 'tree' does not name a type; did you mean 'free'?
 template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
                                 ^~~~
                                 free
cross.cpp:30:1: error: 'Tree' does not name a type; did you mean 'free'?
 Tree<int>tr;
 ^~~~
 free
cross.cpp: In function 'long long int SelectCross(int, std::vector<int>, std::vector<int>)':
cross.cpp:81:3: error: 'tr' was not declared in this scope
   tr.insert(vec[i].second);
   ^~
cross.cpp:81:3: note: suggested alternative: 'tm'
   tr.insert(vec[i].second);
   ^~
   tm