QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#368992#5254. Differencesqq11123334#Compile Error//C++201.4kb2024-03-27 19:00:042024-03-27 19:00:05

Judging History

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

  • [2024-03-27 19:00:05]
  • 评测
  • [2024-03-27 19:00:04]
  • 提交

answer

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int N = 100005;
int cnt[N][4];
vector<vector<int>> v;
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n, m, k;
    cin >> n >> m >> k;

    v.resize(n, vector<int>(m));
    
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            char c;
            cin >> c;
            v[i][j] = (c - 'A');
        }
    }

    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) {
            cnt[j][v[i][j]]++; 
        }
    }

    vector<int> cand;
    for(int i = 0; i < n; i++) {
        ll dif = 0;
        for(int j = 0; j < m; j++) {
            for(int c = 0; c < 4; c++) {
                if(v[i][j] == c) continue;
                dif += cnt[j][c];
            }
        }

        if((n - 1) * k == dif) cand.push_back(i);
    }

    for(auto x : cand) {
        bool isable = true;
        for(int i = 0; i < n; i++) {
            if(i == x) continue;
            ll dif = 0;
            for(int j = 0; j < m; j++) {
                if(v[x][j] != v[i][j]) dif++;
            }

            if(dif != k) isable = false;
        }

        if(isable) {
            cout << x + 1 << "\n";
            exit(0);
        }
    }

}

详细

In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from answer.code:4:
/usr/include/c++/13/bits/allocator.h: In destructor ‘constexpr std::_Vector_base<std::vector<int>, std::allocator<std::vector<int> > >::_Vector_impl::~_Vector_impl()’:
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘constexpr std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = std::vector<int>]’: target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~