Submission #789927

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

Main.cpp: In function 'long long int readint()':
Main.cpp:4:26: error: '_getchar_nolock' was not declared in this scope; did you mean 'getchar_unlocked'?
    4 | #define getchar_unlocked _getchar_nolock
      |                          ^~~~~~~~~~~~~~~
Main.cpp:8:13: note: in expansion of macro 'getchar_unlocked'
    8 |   char ch = getchar_unlocked();
      |             ^~~~~~~~~~~~~~~~
At global scope:
cc1plus: error: '::main' must return 'int'