제출 #789925

#제출 시각아이디문제언어결과실행 시간메모리
789925shoryu386Advertisement 2 (JOI23_ho_t2)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; inline int readint() { int x = 0; char ch = getchar_unlocked(); while (ch < '0' || ch > '9') ch = getchar_unlocked(); while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar_unlocked(); } return x; } int main() { int n; cin >> n; pair<int, int> origin[n]; int pmax[n], smax[n]; for (int x = 0; x < n; x++) { origin[x].first = readint(); origin[x].second = readint(); } int carry = -INT_MAX; for (int x = 0; x < n; x++) { pmax[x] = carry; carry = max(carry, origin[x].first + origin[x].second); } carry = -INT_MAX; for (int x = n - 1; x > -1; x--) { smax[x] = carry; carry = max(carry, origin[x].second - origin[x].first); } int ans = 0; for (int x = 0; x < n; x++) { if (origin[x].first + origin[x].second > pmax[x] && origin[x].second - origin[x].first > smax[x]) { ans++; } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...