Submission #1088110

#TimeUsernameProblemLanguageResultExecution timeMemory
1088110WendidiaskAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
299 ms24792 KiB
/* :---:--:--::::::--:-:----: ::-:::. ::-::: .* -===.. :--- .-+*##=-------====-: :--: :+##=.* -= :=+- .-=: .+++-. :- -=. .=+- .--. .++=- + -= :*- :-. +*+- :- -=. -*: :=: #*: * -=. +- .= =:%+ -: -=. +- -- -%: * -=. *: +. :%-.. =. -=. # -: :=# .. + -=. == -= ---+ . = -=. .# .+ -: == . = :------::------:.-=. % .= :- == .=. ---:. :--#+. .% :- = .* .+.. :=- :++ -+ =: + #. + -=: :*%-*: * := :# :=:= . :-----: =+-+ .+ * -* *=- . .- :::::::. :* .#+. + :- -+ :#. --::-----: :* ++= .- + :*. *. .:::::*%: ++ +.-=. + + -#**----: .= -*. + -= = * +.#=+: + . .=+: =. -=. = = -+ :++: + .. .=+= .= -=. - = %- :====-:. =. .:--===- * -=. - + +-- .:--==#==-:.= + -=. = * + * =. : .= -=. = + = * + = -=. + :- = .= =: = -=. .- * + =: * * -=. + :- .+ =- :- .+ -=. .+ * * := * := -= * = :- =: .- .=: -=. =: -: * .=- + .=- -= :- =: -: --: :- :--: -=. .= =:+ ----. * :---. -= .+ --=*----------------------=*+=--=+--=+*+------------------------------------------------%+:. :: := +:- -- :. .=. =. -= -= .=: .=. .=: .+: :-- :-: -- -=. :--. --: :--: .--: .-:-: ::--. :----. .:---- .:::::::::-::::::--::::::::. */ #include <bits/stdc++.h> using namespace std; using namespace std::chrono; #define int long long #define debug(x) cerr << #x << " is " << x << "\n" #define hehe ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define rep(i, a, b) for (int i = a; i <= b; i++) #define repb(i, a, b) for (int i = b; i >= a; i--) #define pii pair<int, int> #define linebreak cout << "---------------------------------------------------------\n" #define f first #define s second #define pb push_back #define START auto start = high_resolution_clock::now(); #define END cout << '\n'; auto stop = high_resolution_clock::now(); auto duration = duration_cast<microseconds>(stop - start); long double time = duration.count();cout << "Time taken: " << time/1000000.0 << " seconds" << '\n'; // good luck #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") const int MS = 5e5+5, mod = 1e9+7; int n; pii p[MS]; stack<pii> st; int32_t main() { cin >> n; for (int i = 1; i <= n; i++) { int x, e; cin >> x >> e; p[i] = {e-x, x+e}; } sort(p+1, p+n+1); for (int i = 1; i <= n; i++) { while (!st.empty() and st.top().f <= p[i].f and st.top().s <= p[i].s) st.pop(); st.push(p[i]); } cout << st.size(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...