Submission #1309734

#TimeUsernameProblemLanguageResultExecution timeMemory
1309734kawhietExamination (JOI19_examination)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, q; cin >> n >> q; vector<int> s(n), t(n); for (int i = 0; i < n; i++) { cin >> s[i] >> t[i]; } vector<int> ord(n); ranges::iota(ord, 0); ranges::sort(ord, [&](int i, int j) { return s[i] + t[i] < s[j] + t[j]; }); vector<int> a(n), b(n), k(n); for (int i = 0; i < n; i++) { a[i] = s[ord[i]]; b[i] = t[ord[i]]; k[i] = a[i] + b[i]; } while (q--) { int x, y, z; cin >> x >> y >> z; z = max(z, x + y); int pos = ranges::lower_bound(k, z) - k.begin(); if (pos == n) { cout << 0 << '\n'; continue; } int ans = n - pos; for (int i = pos; i < n; i++) { if (a[i] < x) { ans--; } if (b[i] < y) { ans--; } } cout << ans << '\n'; } return 0; }

Compilation message (stderr)

examination.cpp: In function 'int main()':
examination.cpp:14:13: error: 'iota' is not a member of 'std::ranges'
   14 |     ranges::iota(ord, 0);
      |             ^~~~
examination.cpp:14:13: note: suggested alternatives:
In file included from /usr/include/c++/13/numeric:62,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:58,
                 from examination.cpp:1:
/usr/include/c++/13/bits/stl_numeric.h:88:5: note:   'std::iota'
   88 |     iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
      |     ^~~~
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:89:
/usr/include/c++/13/ranges:716:26: note:   'std::ranges::views::iota'
  716 |   inline constexpr _Iota iota{};
      |                          ^~~~