제출 #141290

#제출 시각아이디문제언어결과실행 시간메모리
141290meatrowLightning Rod (NOI18_lightningrod)C++17
40 / 100
2053 ms187876 KiB
//#pragma GCC optimize("O3") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native") //#pragma GCC optimize ("unroll-loops") #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; vector<pair<int, int>> a(n); for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; a[i] = { x + y, x - y }; } sort(a.begin(), a.end()); int ans = 0; int y = INT32_MAX; for (int i = n - 1; i >= 0; i--) { if (a[i].second < y) { ans++; } y = min(y, a[i].second); } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...