Submission #789931

#TimeUsernameProblemLanguageResultExecution timeMemory
789931shoryu386Advertisement 2 (JOI23_ho_t2)C++17
100 / 100
70 ms11284 KiB
#include <bits/stdc++.h> using namespace std; #define int long long //#define getchar_unlocked _getchar_nolock 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; } main(){ int n = readint(); pair<int, int> arr[n]; for (int x = 0; x < n; x++) arr[x].first = readint(), arr[x].second = readint(), arr[x] = make_pair(arr[x].first - arr[x].second, -(arr[x].first + arr[x].second)); sort(arr, arr+n); int prevY = LLONG_MIN/10; int ans = 0; for (int x = 0; x < n; x++){ arr[x].second = -arr[x].second; if (arr[x].second > prevY){ ans++; prevY = arr[x].second; } } cout << ans; }

Compilation message (stderr)

Main.cpp:30:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   30 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...