QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#629371 | #9319. Bull Farm | Andyqian7 | Compile Error | / | / | C++14 | 4.5kb | 2024-10-11 11:00:28 | 2024-10-11 11:00:29 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i, s, e) for (int i = s; i <= e; i++)
using namespace std;
const int N = 2024;
int n, l, q, t[N][N];
struct node
{
int a, b, no, ans;
friend bool operator<(node x, node y)
{
return x.no < y.no;
}
};
void qr(int &x)
{
x = (getchar() - 48) * 50 + getchar() - 48;
}
int main()
{
int T;
scanf("%d", &T);
while (T--)
{
scanf("%d%d%d\n", &n, &l, &q);
rep(i, 1, l)
{
rep(j, 1, n)
{
qr(t[i][j]);
}
getchar();
}
bitset<N> b[N];
rep(i, 1, n)
{
b[i][i] = 1;
}
vector<node> v[N];
rep(i, 1, q)
{
int a, b, c;
qr(a), qr(b), qr(c), getchar();
v[c].push_back({a, b, i});
}
for (auto &[a, B, _, ans] : v[0])
{
ans = b[a][B];
}
rep(i, 1, l)
{
int cnt[N] = {};
rep(j, 1, n)
cnt[t[i][j]]++;
int c = 0, emp;
rep(j, 1, n) if (cnt[j] > 1) c += cnt[j] - 1;
if (c <= 1)
{
if (!c)
{
rep(j, 1, n)
{
emp = t[i][j];
b[j] |= b[emp];
}
}
else
{
vector<int> C;
rep(j, 1, n)
{
if (!cnt[j])
emp = j;
if (cnt[t[i][j]] == 2)
C.push_back(j);
}
for (auto c : C)
b[c] |= b[emp];
}
}
for (auto &[a, B, _, ans] : v[i])
{
ans = b[a][B];
}
}
vector<node> all;
rep(i, 0, l)
{
for (auto j : v[i])
all.push_back(j);
}
sort(all.begin(), all.end());
for (auto i : all)
{
putchar(i.ans + 48);
}
puts("");
}
}#include <bits/stdc++.h>
#define rep(i, s, e) for (int i = s; i <= e; i++)
using namespace std;
const int N = 2024;
int n, l, q, t[N][N];
struct node
{
int a, b, no, ans;
friend bool operator<(node x, node y)
{
return x.no < y.no;
}
};
void qr(int &x)
{
x = (getchar() - 48) * 50 + getchar() - 48;
}
int main()
{
int T;
scanf("%d", &T);
while (T--)
{
scanf("%d%d%d\n", &n, &l, &q);
rep(i, 1, l)
{
rep(j, 1, n)
{
qr(t[i][j]);
}
getchar();
}
bitset<N> b[N];
rep(i, 1, n)
{
b[i][i] = 1;
}
vector<node> v[N];
rep(i, 1, q)
{
int a, b, c;
qr(a), qr(b), qr(c), getchar();
v[c].push_back({a, b, i});
}
for (auto &[a, B, _, ans] : v[0])
{
ans = b[a][B];
}
rep(i, 1, l)
{
int cnt[N] = {};
rep(j, 1, n)
cnt[t[i][j]]++;
int c = 0, emp;
rep(j, 1, n) if (cnt[j] > 1) c += cnt[j] - 1;
if (c <= 1)
{
if (!c)
{
rep(j, 1, n)
{
emp = t[i][j];
b[j] |= b[emp];
}
}
else
{
vector<int> C;
rep(j, 1, n)
{
if (!cnt[j])
emp = j;
if (cnt[t[i][j]] == 2)
C.push_back(j);
}
for (auto c : C)
b[c] |= b[emp];
}
}
for (auto &[a, B, _, ans] : v[i])
{
ans = b[a][B];
}
}
vector<node> all;
rep(i, 0, l)
{
for (auto j : v[i])
all.push_back(j);
}
sort(all.begin(), all.end());
for (auto i : all)
{
putchar(i.ans + 48);
}
puts("");
}
}
Details
answer.code:98:2: error: stray ‘#’ in program 98 | }#include <bits/stdc++.h> | ^ answer.code: In function ‘int main()’: answer.code:45:20: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 45 | for (auto &[a, B, _, ans] : v[0]) | ^ answer.code:80:24: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 80 | for (auto &[a, B, _, ans] : v[i]) | ^ answer.code: At global scope: answer.code:98:3: error: ‘include’ does not name a type 98 | }#include <bits/stdc++.h> | ^~~~~~~ answer.code:101:11: error: redefinition of ‘const int N’ 101 | const int N = 2024; | ^ answer.code:4:11: note: ‘const int N’ previously defined here 4 | const int N = 2024; | ^ answer.code:102:5: error: redefinition of ‘int n’ 102 | int n, l, q, t[N][N]; | ^ answer.code:5:5: note: ‘int n’ previously declared here 5 | int n, l, q, t[N][N]; | ^ answer.code:102:8: error: redefinition of ‘int l’ 102 | int n, l, q, t[N][N]; | ^ answer.code:5:8: note: ‘int l’ previously declared here 5 | int n, l, q, t[N][N]; | ^ answer.code:102:11: error: redefinition of ‘int q’ 102 | int n, l, q, t[N][N]; | ^ answer.code:5:11: note: ‘int q’ previously declared here 5 | int n, l, q, t[N][N]; | ^ answer.code:102:14: error: redefinition of ‘int t [2024][2024]’ 102 | int n, l, q, t[N][N]; | ^ answer.code:5:14: note: ‘int t [2024][2024]’ previously declared here 5 | int n, l, q, t[N][N]; | ^ answer.code:103:8: error: redefinition of ‘struct node’ 103 | struct node | ^~~~ answer.code:6:8: note: previous definition of ‘struct node’ 6 | struct node | ^~~~ answer.code:111:6: error: redefinition of ‘void qr(int&)’ 111 | void qr(int &x) | ^~ answer.code:14:6: note: ‘void qr(int&)’ previously defined here 14 | void qr(int &x) | ^~ answer.code:115:5: error: redefinition of ‘int main()’ 115 | int main() | ^~~~ answer.code:18:5: note: ‘int main()’ previously defined here 18 | int main() | ^~~~ answer.code: In function ‘int main()’: answer.code:142:20: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 142 | for (auto &[a, B, _, ans] : v[0]) | ^ answer.code:177:24: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 177 | for (auto &[a, B, _, ans] : v[i]) | ^ answer.code: In function ‘int main()’: answer.code:21:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | scanf("%d", &T); | ~~~~~^~~~~~~~~~ answer.code:24:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 24 | scanf("%d%d%d\n", &n, &l, &q); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ answer.code: In function ‘int main()’: answer.code:118:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 118 | scanf("%d", &T); | ~~~~~^~~~~~~~~~ answer.code:121:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 121 | scanf("%d%d%d\n", &n, &l, &q); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~