Submission #789928

#TimeUsernameProblemLanguageResultExecution timeMemory
789928shoryu386Advertisement 2 (JOI23_ho_t2)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long 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; }

Compilation message (stderr)

cc1plus: error: '::main' must return 'int'