QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#503059 | #1965. Trio | PetroTarnavskyi# | Compile Error | / | / | C++20 | 1.2kb | 2024-08-03 16:05:55 | 2024-08-03 16:05:57 |
Judging History
answer
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
const int N = 2047;
LL masks[N][N];
LL mask[N];
LL f(int a, int b)
{
a--, b--;
if (a == b)
return 1 << a;
return (1 << 9) - 1 - (1 << a) - (1 << b);
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<string> v(n);
FOR (i, 0, n)
{
cin >> v[i];
}
FOR (i, 0, n)
{
FOR (c, 0, 4)
mask[i] |= (1ll << (v[i][c] - '1')) << (c * 9);
FOR (j, i + 1, n)
{
FOR (c, 0, 4)
{
masks[i][j] |= f(v[i][c] - '0', v[j][c] - '0') << (c * 9);
}
}
}
int ans = 0;
FOR (i, 0, n)
{
FOR (j, i + 1, n)
{
FOR (k, j + 1, n)
{
if ((masks[i][j] & mask[k]) == mask[k])
ans++;
}
}
}
cout << ans << '\n';
cerr << db(clock()) / CLOCKS_PER_SEC << '\n';
return 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:3: /usr/include/c++/13/bits/allocator.h: In destructor ‘constexpr std::__cxx11::basic_string<char>::_Alloc_hider::~_Alloc_hider()’: /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 = char]’: target specific option mismatch 184 | ~allocator() _GLIBCXX_NOTHROW { } | ^ In file included from /usr/include/c++/13/string:54: /usr/include/c++/13/bits/basic_string.h:181:14: note: called from here 181 | struct _Alloc_hider : allocator_type // TODO check __is_final | ^~~~~~~~~~~~