제출 #1328492

#제출 시각아이디문제언어결과실행 시간메모리
1328492kawhietTopical (NOI23_topical)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long

bool is(vector<int> &a, vector<int> &b) {
    for (int i = 0; i < a.size(); i++) {
        if (a[i] < b[i]) return false;
    }
    return true;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector<vector<int>> r(n, vector<int>(k));
    vector<vector<int>> u(n, vector<int>(k));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < k; j++) {
            cin >> r[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < k; j++) {
            cin >> u[i][j];
        }
    }
    vector<int> ord(n);
    ranges::iota(ord, 0);
    ranges::sort(ord, [&](int i, int j) {
        return u[i] < u[j];
    });
    vector<bool> vis(n);
    vector<int> x(k);
    int ans = 0;
    for (int _ = 0; _ < n; _++) {
        bool ok = 0;
        for (int pos = 0; pos < n; pos++) {
            int i = ord[pos];
            if (is(x, r[i]) && !vis[i]) {
                ans++;
                vis[i] = 1;
                for (int j = 0; j < k; j++) {
                    x[j] += u[i][j];
                }
            }
            ok = 1;
        }
        if (!ok) {
            break;
        }
    }
    cout << ans << '\n';
    return 0;
}

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

Main.cpp: In function 'int main()':
Main.cpp:31:13: error: 'iota' is not a member of 'std::ranges'
   31 |     ranges::iota(ord, 0);
      |             ^~~~
Main.cpp:31: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 Main.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{};
      |                          ^~~~