제출 #785672

#제출 시각아이디문제언어결과실행 시간메모리
785672shart23Advertisement 2 (JOI23_ho_t2)C++14
100 / 100
167 ms5344 KiB
#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; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int ri()':
Main.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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...