Submission #785671

# Submission time Handle Problem Language Result Execution time Memory
785671 2023-07-17T12:00:51 Z shart23 Growing Vegetable is Fun 3 (JOI19_ho_t3) C++14
0 / 100
1 ms 212 KB
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>

int ri() {
  int n;
  scanf("%d", &n);
  return n;
}

int main() {
  int N = ri();
  std::vector<std::pair<int, int> > points(N);
  for (int i = 0; i < N; i++) {
    int X = ri();
    int E = ri();
    points[i] = {X - E, X + E}; // {a[i], b[i]}
  }
  
  // aåŒã˜ãªã‚‰bé™é †ã«ã™ã‚‹ã¨ã€aãŒåŒã˜ã‚„ã¤ã§è¤‡æ•°å›žbã®æœ€å¤§å€¤ã‚’æ›´æ–°ã—ã¦ã—ã¾ã£ãŸã‚Šã—ãªããªã‚‹
  std::sort(points.begin(), points.end(), [] (auto &i, auto &j) {
    if (i.first != j.first) return i.first < j.first;
    return i.second > j.second;
  });
  int max = -1;
  int cnt = 0;
  for (auto i : points) if (max < i.second) max = i.second, cnt++;
  
  printf("%d\n", cnt);
  return 0;
}

Compilation message

joi2019_ho_t3.cpp: In function 'int ri()':
joi2019_ho_t3.cpp:8:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -