Submission #789930

#TimeUsernameProblemLanguageResultExecution timeMemory
789930shoryu386Advertisement 2 (JOI23_ho_t2)C++17
Compilation error
0 ms0 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: In function 'long long int readint()':
Main.cpp:6:26: error: '_getchar_nolock' was not declared in this scope; did you mean 'getchar_unlocked'?
    6 | #define getchar_unlocked _getchar_nolock
      |                          ^~~~~~~~~~~~~~~
Main.cpp:12:13: note: in expansion of macro 'getchar_unlocked'
   12 |   char ch = getchar_unlocked();
      |             ^~~~~~~~~~~~~~~~
Main.cpp: At global scope:
Main.cpp:30:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   30 | main(){
      | ^~~~