QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#490089#7362. 割hcywoiCompile Error//C++201009b2024-07-25 11:09:302024-11-23 17:01:32

Judging History

你现在查看的是最新测评结果

  • [2024-11-23 17:01:32]
  • 管理员手动重测本题所有提交记录
  • [2024-07-25 11:09:30]
  • 评测
  • [2024-07-25 11:09:30]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int n, m;
    std::cin >> n >> m;

    std::vector<std::vector<int>> adj(n);
    for (int i = 0; i < m; i ++ ) {
        int u, v;
        std::cin >> u >> v;
        u -- ;
        v -- ;
        if (u < v) {
            std::swap(u, v);
        }
        adj[u].push_back(v);
    }

    std::vector<int> s0, s1;
    for (int i = 0; i < n; i ++ ) {
        int v0 = 0, v1 = 0;
        for (auto x : s0) {
            v0 += adj[i].count(x);
        }
        for (auto x : s1) {
            v1 += adj[i].count(x);
        }
        if (v0 > v1) {
            s1.push_back(v1);
        } else {
            s0.push_back(v0);
        }
    }

    std::vector<int> ans(n);
    for (auto x : s1) {
        ans[x] = 1;
    }
    for (int i = 0; i < n; i ++ ) {
        std::cout << ans[i] << " \n"[i == n - 1];
    }

    return 0;
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:28:26: error: ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type’ {aka ‘class std::vector<int>’} has no member named ‘count’
   28 |             v0 += adj[i].count(x);
      |                          ^~~~~
answer.code:31:26: error: ‘__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type’ {aka ‘class std::vector<int>’} has no member named ‘count’
   31 |             v1 += adj[i].count(x);
      |                          ^~~~~