Submission #883716

#TimeUsernameProblemLanguageResultExecution timeMemory
883716tsumondaitrapezoid (balkan11_trapezoid)C++14
100 / 100
94 ms22248 KiB
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, "/stack:336777216") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #define int long long #define tl fi.fi #define tr fi.se #define dl se.fi #define dr se.se #define fi first #define se second #define pb push_back #define mp make_pair #define foru(i, l, r) for(int i = l; i <= r; i++) #define ford(i, r, l) for(int i = r; i >= l; i--) #define __TIME (1.0 * clock() / CLOCKS_PER_SEC) typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<ii, ii> iiii; const int N = 5e5 + 5; const int oo = 1e9, mod = 30013; pair <ii, ii> a[N]; ii bit[N]; int n; void update (int x, ii val) { for (; x <= 2 * n; x += x & -x) if (bit[x].fi < val.fi) bit[x] = val; else if (bit[x].fi == val.fi) bit[x].se = (bit[x].se + val.se) % mod; } ii get (int x) { ii ans = {0, 1}; for (; x > 0; x -= x & -x) if (bit[x].fi > ans.fi) ans = bit[x]; else if (bit[x].fi == ans.fi) ans.se = (ans.se + bit[x].se) % mod; return ans; } ii ret, res[N]; vector <int> t, d; int g[N], u[N]; void process() { cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i].tl >> a[i].tr >> a[i].dl >> a[i].dr; t.pb(a[i].tl); t.pb(a[i].tr); d.pb(a[i].dl); d.pb(a[i].dr); } sort(t.begin(), t.end()); sort(d.begin(), d.end()); t.erase(unique(t.begin(), t.end()), t.end()); d.erase(unique(d.begin(), d.end()), d.end()); for (int i = 1; i <= n; ++i) { a[i].tl = lower_bound (t.begin(), t.end(), a[i].tl) - t.begin() + 1; a[i].tr = lower_bound (t.begin(), t.end(), a[i].tr) - t.begin() + 1; a[i].dl = lower_bound (d.begin(), d.end(), a[i].dl) - d.begin() + 1; a[i].dr = lower_bound (d.begin(), d.end(), a[i].dr) - d.begin() + 1; g[a[i].tl] = i; u[a[i].tr] = i; } for (int i = 1; i <= 2 * n; i++) { if (g[i]) { int v = g[i]; ii f = get(a[v].dl); ++f.fi; res[v] = f; if (f.fi > ret.fi) ret = f; else if (f.fi == ret.fi) ret.se = (ret.se + f.se) % mod; } else { int v = u[i]; update(a[v].dr, res[v]); } } cout << ret.fi << " " << ret.se; return; } signed main() { cin.tie(0)->sync_with_stdio(false); //freopen(".inp", "r", stdin); //freopen(".out", "w", stdout); process(); cerr << "Time elapsed: " << __TIME << " s.\n"; return 0; } // dont stop

Compilation message (stderr)

trapezoid.cpp:4: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    4 | #pragma comment(linker, "/stack:336777216")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...