Submission #1149607

#TimeUsernameProblemLanguageResultExecution timeMemory
1149607henriessAdvertisement 2 (JOI23_ho_t2)C++20
Compilation error
0 ms0 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

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:31:15: error: expected primary-expression at end of input
   31 |         return
      |               ^
Main.cpp:31:15: error: expected ';' at end of input
   31 |         return
      |               ^
      |               ;
Main.cpp:31:15: error: expected '}' at end of input
Main.cpp:12:12: note: to match this '{'
   12 | int main() {
      |            ^
Main.cpp: In function 'int ri()':
Main.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~