QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#568814 | #9319. Bull Farm | miaomiaomiao | Compile Error | / | / | C++17 | 2.5kb | 2024-09-16 18:41:08 | 2024-09-16 18:41:09 |
Judging History
This is the latest submission verdict.
- [2024-09-16 18:41:09]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-09-16 18:41:08]
- Submitted
answer
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma")
#include <bits/stdc++.h>
using namespace std;
#define For(i,n) for (int i=1;i<=(int)(n);i++)
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define all(x) (x).begin(),(x).end()
#define fore(i,x) for (auto &i:x)
#define pii pair<int,int>
#define vi vector <int>
#define pb push_back
#define ll long long
#define endl '\n'
const int MOD = 998244353;
const int INF = 0x7fffffff;
const int MAXN = 2000 + 3;
int n, c, q;
int tr[MAXN][MAXN];
int a[MAXN][MAXN];
#define tr(j) ((s[2*j]-48)*50+s[2*j+1]-48)
void solve() {
cin >> n >> c >> q;
rep(i, n + 2) {
rep(j, n + 2) {
a[i][j] = INF;
}
a[i][i] = 0;
}
For(i, c) {
string s;
cin >> s;
unordered_set <int> st;
bool ok = 1;
int con = -1;
For(j, n) {
int t = tr((j-1));
tr[i][j] = t;
// cout << a[i][j] << ",";
if (st.count(t)) {
if (con != -1) {
ok = 0;
break;
}
con = t;
}
st.insert(t);
}
// if (!ok) cout << "@";
if (ok) {
if (con == -1) {
// cout << "!";
For(j, n) {
a[j][tr[i][j]] = min(a[j][tr[i][j]],i);
}
} else {
vi v;
unordered_set<int> dst;
For(j, n) {
dst.insert(j);
}
For(j, n) {
dst.erase(tr[i][j]);
if (tr[i][j] == con) v.push_back(j);
}
int last = *dst.begin();
a[v[0]][last] = min(a[v[0]][last],i);
a[v[1]][last] = min(a[v[1]][last],i);
}
}
}
// cout << "!!!" << d[5][1] << endl;
for (int i = 1;i <= n;i++) {
queue<int> q[MAXN];
vi vis(MAXN);
fore(j, vis) j = INF;
// vis[i] = 0;
q[0].push(i);
// for (int j = 1;j <= n;j++) {
// if (d[i][j] != INF) {
// q[d[i][j]].push(j);
// }
// }
for (int lm = 0;lm <= n;lm++) {
while (!q[lm].empty()) {
int j = q[lm].front();
q[lm].pop();
if (vis[j]<lm) continue;
vis[j] = lm;
a[i][j] = min(a[i][j],lm);
For(k, n) {
if (a[j][k] != INF && max(lm, a[j][k])<vis[k]) {
q[max(lm, a[j][k])].push(k);
vis[k] = max(lm, a[j][k]);
}
}
}
}
}
rep(i, q) {
string s;
cin >> s;
int st, ed, lm;
st = tr(0);
ed = tr(1);
lm = tr(2);
// cout << endl<<st << " " << ed << " " << lm << " " << d[st][ed] << endl<<endl;
if (a[st][ed] <= lm) cout << "1"; else cout << "0";
}
cout << endl;
}
int main() {
ios::sync_with_stdio(false);cin.tie(0);
int T;
cin >> T;
while (T--) {
solve();
}
return 0;
}
Details
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 ‘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’ ‘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 | ^~~~~~~~~~~~