submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s489090060 | p03802 | C++ | #include <bits/stdc++.h>
#define RI register int
#define lc (x << 1)
#define rc (x << 1 | 1)
using namespace std;
int const MAXN = 5e7 + 5;
int MaxNode = 0, n, _2n;
struct Edges { int to, next; } e[MAXN * 2];
int head[MAXN], tot;
int Dfn[MAXN], Col[MAXN], col, Low[MAXN], cnt, stk[MAXN], top, vis[MAXN];
struct nodes { int x, y; } a[MAXN];
struct Nodes { int x, id; } t[MAXN];
inline bool cmp(Nodes x, Nodes y) { return x.x < y.x; }
inline void addedge(int from, int to) {
e[++tot] = (Edges){to, head[from]};
head[from] = tot;
}
void Get_MaxNode(int x, int l, int r) {
MaxNode = max(MaxNode, x);
if (l == r) return;
int mid = (l + r) >> 1;
Get_MaxNode(lc, l, mid);
Get_MaxNode(rc, mid + 1, r);
}
void Build(int x, int l, int r, int opt) {
if (!opt) addedge(x, x + MaxNode);
if (l == r) return;
if (!opt) addedge(x, lc), addedge(x, rc);
else addedge(lc + MaxNode, x + MaxNode), addedge(rc + MaxNode, x + MaxNode);
int mid = (l + r) >> 1;
Build(lc, l, mid, opt);
Build(rc, mid + 1, r, opt);
}
int Get(int x, int l, int r, int to) {
if (l == r) return x;
int mid = (l + r) >> 1;
if (to <= mid) return Get(lc, l, mid, to);
else return Get(rc, mid + 1, r, to);
}
void Link(int x, int l, int r, int i, int j, int node) {
if (i > j) return;
if (l == r) return addedge(x + MaxNode, node);
int mid = (l + r) >> 1;
if (i <= mid) Link(lc, l, mid, i, j, node);
if (j > mid) Link(rc, mid + 1, r, i, j, node);
}
void Tarjan(int k) {
Low[k] = Dfn[k] = ++cnt;
vis[k] = stk[++top] = k;
for (RI i = head[k]; i; i = e[i].next)
if (!Dfn[e[i].to]) {
Tarjan(e[i].to);
Low[k] = min(Low[k], Low[e[i].to]);
}
else if (vis[e[i].to]) Low[k] = min(Low[k], Dfn[e[i].to]);
if (Dfn[k] == Low[k]) {
++col;
while (stk[top] != k) Col[stk[top]] = col, vis[stk[top]] = 0, --top;
Col[stk[top]] = col, vis[stk[top]] = 0, --top;
}
}
bool Check(int k) {
for (RI i = 1; i <= MaxNode * 2; ++i)
head[i] = Dfn[i] = Low[i] = Col[i] = 0;
tot = cnt = col = top = 0;
Build(1, 1, _2n, 0);
Build(1, 1, _2n, 1);
for (RI i = 1; i <= _2n; ++i) {
int l = 1, r = i - 1, mid, ll = i;
while (l <= r) {
mid = (l + r) >> 1;
if (t[i].x - t[mid].x >= k) l = mid + 1;
else ll = mid, r = mid - 1;
}
l = i + 1, r = _2n; int rr = i;
while (l <= r) {
mid = (l + r) >> 1;
if (t[mid].x - t[i].x >= k) r = mid - 1;
else rr = mid, l = mid + 1;
}
Link(1, 1, _2n, ll, i - 1, Get(1, 1, _2n, a[t[i].id].x == i ? a[t[i].id].y : a[t[i].id].x));
Link(1, 1, _2n, i + 1, rr, Get(1, 1, _2n, a[t[i].id].x == i ? a[t[i].id].y : a[t[i].id].x));
}
for (RI i = 1; i <= 2 * MaxNode; ++i)
if (!Dfn[i]) Tarjan(i);
for (RI i = 1; i <= n; ++i)
if (Col[Get(1, 1, _2n, a[i].x)] == Col[Get(1, 1, _2n, a[i].y)])
return 0;
return 1;
}
int main() {
// freopen("a.in", "r", stdin);
// freopen("a.out", "w", stdout);
ios :: sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> n; _2n = n + n;
Get_MaxNode(1, 1, _2n);
for (RI i = 1; i <= n; ++i)
cin >> t[i * 2 - 1].x >> t[i * 2].x, t[i * 2 - 1].id = t[i * 2].id = i;
sort(t + 1, t + 1 + _2n, cmp);
for (RI i = 1; i <= _2n; ++i) {
if (!a[t[i].id].x) a[t[i].id].x = i;
else a[t[i].id].y = i;
}
int l = 1, r = 1e9, mid, ans = 0;
while (l <= r) {
mid = (l + r) >> 1;
if (Check(mid)) ans = mid, l = mid + 1;
else r = mid - 1;
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'void Tarjan(int)':
a.cc:57:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
57 | for (RI i = head[k]; i; i = e[i].next)
| ^
a.cc: In function 'bool Check(int)':
a.cc:71:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
71 | for (RI i = 1; i <= MaxNode * 2; ++i)
| ^
a.cc:76:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
76 | for (RI i = 1; i <= _2n; ++i) {
| ^
a.cc:92:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
92 | for (RI i = 1; i <= 2 * MaxNode; ++i)
| ^
a.cc:94:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
94 | for (RI i = 1; i <= n; ++i)
| ^
a.cc: In function 'int main()':
a.cc:107:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
107 | for (RI i = 1; i <= n; ++i)
| ^
a.cc:110:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
110 | for (RI i = 1; i <= _2n; ++i) {
| ^
/tmp/ccDkNDF8.o: in function `Check(int)':
a.cc:(.text+0x79f): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccDkNDF8.o
a.cc:(.text+0x7b6): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccDkNDF8.o
a.cc:(.text+0x817): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccDkNDF8.o
a.cc:(.text+0x82c): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccDkNDF8.o
a.cc:(.text+0x86a): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccDkNDF8.o
a.cc:(.text+0x897): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccDkNDF8.o
a.cc:(.text+0x8c2): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccDkNDF8.o
a.cc:(.text+0x929): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccDkNDF8.o
a.cc:(.text+0x956): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccDkNDF8.o
a.cc:(.text+0x981): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccDkNDF8.o
/tmp/ccDkNDF8.o: in function `main':
a.cc:(.text+0xb76): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s749741543 | p03802 | C++ | #include <bits/stdc++.h>
#define RI register int
#define lc (x << 1)
#define rc (x << 1 | 1)
using namespace std;
int const MAXN = 1e8 + 5;
int MaxNode = 0, n, _2n;
struct Edges { int to, next; } e[MAXN * 2];
int head[MAXN], tot;
int Dfn[MAXN], Col[MAXN], col, Low[MAXN], cnt, stk[MAXN], top, vis[MAXN];
struct nodes { int x, y; } a[MAXN];
struct Nodes { int x, id; } t[MAXN];
inline bool cmp(Nodes x, Nodes y) { return x.x < y.x; }
inline void addedge(int from, int to) {
e[++tot] = (Edges){to, head[from]};
head[from] = tot;
}
void Get_MaxNode(int x, int l, int r) {
MaxNode = max(MaxNode, x);
if (l == r) return;
int mid = (l + r) >> 1;
Get_MaxNode(lc, l, mid);
Get_MaxNode(rc, mid + 1, r);
}
void Build(int x, int l, int r, int opt) {
if (!opt) addedge(x, x + MaxNode);
if (l == r) return;
if (!opt) addedge(x, lc), addedge(x, rc);
else addedge(lc + MaxNode, x + MaxNode), addedge(rc + MaxNode, x + MaxNode);
int mid = (l + r) >> 1;
Build(lc, l, mid, opt);
Build(rc, mid + 1, r, opt);
}
int Get(int x, int l, int r, int to) {
if (l == r) return x;
int mid = (l + r) >> 1;
if (to <= mid) return Get(lc, l, mid, to);
else return Get(rc, mid + 1, r, to);
}
void Link(int x, int l, int r, int i, int j, int node) {
if (i > j) return;
if (l == r) return addedge(x + MaxNode, node);
int mid = (l + r) >> 1;
if (i <= mid) Link(lc, l, mid, i, j, node);
if (j > mid) Link(rc, mid + 1, r, i, j, node);
}
void Tarjan(int k) {
Low[k] = Dfn[k] = ++cnt;
vis[k] = stk[++top] = k;
for (RI i = head[k]; i; i = e[i].next)
if (!Dfn[e[i].to]) {
Tarjan(e[i].to);
Low[k] = min(Low[k], Low[e[i].to]);
}
else if (vis[e[i].to]) Low[k] = min(Low[k], Dfn[e[i].to]);
if (Dfn[k] == Low[k]) {
++col;
while (stk[top] != k) Col[stk[top]] = col, vis[stk[top]] = 0, --top;
Col[stk[top]] = col, vis[stk[top]] = 0, --top;
}
}
bool Check(int k) {
for (RI i = 1; i <= MaxNode * 2; ++i)
head[i] = Dfn[i] = Low[i] = Col[i] = 0;
tot = cnt = col = top = 0;
Build(1, 1, _2n, 0);
Build(1, 1, _2n, 1);
for (RI i = 1; i <= _2n; ++i) {
int l = 1, r = i - 1, mid, ll = i;
while (l <= r) {
mid = (l + r) >> 1;
if (t[i].x - t[mid].x >= k) l = mid + 1;
else ll = mid, r = mid - 1;
}
l = i + 1, r = _2n; int rr = i;
while (l <= r) {
mid = (l + r) >> 1;
if (t[mid].x - t[i].x >= k) r = mid - 1;
else rr = mid, l = mid + 1;
}
Link(1, 1, _2n, ll, i - 1, Get(1, 1, _2n, a[t[i].id].x == i ? a[t[i].id].y : a[t[i].id].x));
Link(1, 1, _2n, i + 1, rr, Get(1, 1, _2n, a[t[i].id].x == i ? a[t[i].id].y : a[t[i].id].x));
}
for (RI i = 1; i <= 2 * MaxNode; ++i)
if (!Dfn[i]) Tarjan(i);
for (RI i = 1; i <= n; ++i)
if (Col[Get(1, 1, _2n, a[i].x)] == Col[Get(1, 1, _2n, a[i].y)])
return 0;
return 1;
}
int main() {
// freopen("a.in", "r", stdin);
// freopen("a.out", "w", stdout);
ios :: sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> n; _2n = n + n;
Get_MaxNode(1, 1, _2n);
for (RI i = 1; i <= n; ++i)
cin >> t[i * 2 - 1].x >> t[i * 2].x, t[i * 2 - 1].id = t[i * 2].id = i;
sort(t + 1, t + 1 + _2n, cmp);
for (RI i = 1; i <= _2n; ++i) {
if (!a[t[i].id].x) a[t[i].id].x = i;
else a[t[i].id].y = i;
}
int l = 1, r = 1e9, mid, ans = 0;
while (l <= r) {
mid = (l + r) >> 1;
if (Check(mid)) ans = mid, l = mid + 1;
else r = mid - 1;
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'void Tarjan(int)':
a.cc:57:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
57 | for (RI i = head[k]; i; i = e[i].next)
| ^
a.cc: In function 'bool Check(int)':
a.cc:71:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
71 | for (RI i = 1; i <= MaxNode * 2; ++i)
| ^
a.cc:76:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
76 | for (RI i = 1; i <= _2n; ++i) {
| ^
a.cc:92:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
92 | for (RI i = 1; i <= 2 * MaxNode; ++i)
| ^
a.cc:94:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
94 | for (RI i = 1; i <= n; ++i)
| ^
a.cc: In function 'int main()':
a.cc:107:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
107 | for (RI i = 1; i <= n; ++i)
| ^
a.cc:110:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
110 | for (RI i = 1; i <= _2n; ++i) {
| ^
/tmp/ccF5DmLU.o: in function `Tarjan(int)':
a.cc:(.text+0x2ae): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccF5DmLU.o
a.cc:(.text+0x2b7): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccF5DmLU.o
a.cc:(.text+0x2bd): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccF5DmLU.o
a.cc:(.text+0x301): relocation truncated to fit: R_X86_64_PC32 against symbol `Low' defined in .bss section in /tmp/ccF5DmLU.o
a.cc:(.text+0x30d): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccF5DmLU.o
a.cc:(.text+0x316): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccF5DmLU.o
a.cc:(.text+0x31c): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccF5DmLU.o
a.cc:(.text+0x32e): relocation truncated to fit: R_X86_64_PC32 against symbol `stk' defined in .bss section in /tmp/ccF5DmLU.o
a.cc:(.text+0x342): relocation truncated to fit: R_X86_64_PC32 against symbol `stk' defined in .bss section in /tmp/ccF5DmLU.o
a.cc:(.text+0x35a): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccF5DmLU.o
a.cc:(.text+0x3ec): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s490367933 | p03802 | C++ | #include <bits/stdc++.h>
#define RI register int
#define lc (x << 1)
#define rc (x << 1 | 1)
using namespace std;
int const MAXN = 1e8 + 5;
int MaxNode = 0, n, _2n;
struct Edges { int to, next; } e[MAXN * 2];
int head[MAXN], tot;
int Dfn[MAXN], Col[MAXN], col, Low[MAXN], cnt, stk[MAXN], top, vis[MAXN];
struct nodes { int x, y; } a[MAXN];
struct Nodes { int x, id; } t[MAXN];
inline bool cmp(Nodes x, Nodes y) { return x.x < y.x; }
inline void addedge(int from, int to) {
e[++tot] = (Edges){to, head[from]};
head[from] = tot;
}
void Get_MaxNode(int x, int l, int r) {
MaxNode = max(MaxNode, x);
if (l == r) return;
int mid = (l + r) >> 1;
Get_MaxNode(lc, l, mid);
Get_MaxNode(rc, mid + 1, r);
}
void Build(int x, int l, int r, int opt) {
if (!opt) addedge(x, x + MaxNode);
if (l == r) return;
if (!opt) addedge(x, lc), addedge(x, rc);
else addedge(lc + MaxNode, x + MaxNode), addedge(rc + MaxNode, x + MaxNode);
int mid = (l + r) >> 1;
Build(lc, l, mid, opt);
Build(rc, mid + 1, r, opt);
}
int Get(int x, int l, int r, int to) {
if (l == r) return x;
int mid = (l + r) >> 1;
if (to <= mid) return Get(lc, l, mid, to);
else return Get(rc, mid + 1, r, to);
}
void Link(int x, int l, int r, int i, int j, int node) {
if (i > j) return;
if (l == r) return addedge(x + MaxNode, node);
int mid = (l + r) >> 1;
if (i <= mid) Link(lc, l, mid, i, j, node);
if (j > mid) Link(rc, mid + 1, r, i, j, node);
}
void Tarjan(int k) {
Low[k] = Dfn[k] = ++cnt;
vis[k] = stk[++top] = k;
for (RI i = head[k]; i; i = e[i].next)
if (!Dfn[e[i].to]) {
Tarjan(e[i].to);
Low[k] = min(Low[k], Low[e[i].to]);
}
else if (vis[e[i].to]) Low[k] = min(Low[k], Dfn[e[i].to]);
if (Dfn[k] == Low[k]) {
++col;
while (stk[top] != k) Col[stk[top]] = col, vis[stk[top]] = 0, --top;
Col[stk[top]] = col, vis[stk[top]] = 0, --top;
}
}
bool Check(int k) {
for (RI i = 1; i <= MaxNode * 2; ++i)
head[i] = Dfn[i] = Low[i] = Col[i] = 0;
tot = cnt = col = top = 0;
Build(1, 1, _2n, 0);
Build(1, 1, _2n, 1);
for (RI i = 1; i <= _2n; ++i) {
int l = 1, r = i - 1, mid, ll = i;
while (l <= r) {
mid = (l + r) >> 1;
if (t[i].x - t[mid].x >= k) l = mid + 1;
else ll = mid, r = mid - 1;
}
l = i + 1, r = _2n; int rr = i;
while (l <= r) {
mid = (l + r) >> 1;
if (t[mid].x - t[i].x >= k) r = mid - 1;
else rr = mid, l = mid + 1;
}
Link(1, 1, _2n, ll, i - 1, Get(1, 1, _2n, a[t[i].id].x == i ? a[t[i].id].y : a[t[i].id].x));
Link(1, 1, _2n, i + 1, rr, Get(1, 1, _2n, a[t[i].id].x == i ? a[t[i].id].y : a[t[i].id].x));
}
for (RI i = 1; i <= 2 * MaxNode; ++i)
if (!Dfn[i]) Tarjan(i);
for (RI i = 1; i <= n; ++i)
if (Col[Get(1, 1, _2n, a[i].x)] == Col[Get(1, 1, _2n, a[i].y)])
return 0;
return 1;
}
int main() {
freopen("a.in", "r", stdin);
freopen("a.out", "w", stdout);
ios :: sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> n; _2n = n + n;
Get_MaxNode(1, 1, _2n);
for (RI i = 1; i <= n; ++i)
cin >> t[i * 2 - 1].x >> t[i * 2].x, t[i * 2 - 1].id = t[i * 2].id = i;
sort(t + 1, t + 1 + _2n, cmp);
for (RI i = 1; i <= _2n; ++i) {
if (!a[t[i].id].x) a[t[i].id].x = i;
else a[t[i].id].y = i;
}
int l = 1, r = 1e9, mid, ans = 0;
while (l <= r) {
mid = (l + r) >> 1;
if (Check(mid)) ans = mid, l = mid + 1;
else r = mid - 1;
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'void Tarjan(int)':
a.cc:57:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
57 | for (RI i = head[k]; i; i = e[i].next)
| ^
a.cc: In function 'bool Check(int)':
a.cc:71:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
71 | for (RI i = 1; i <= MaxNode * 2; ++i)
| ^
a.cc:76:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
76 | for (RI i = 1; i <= _2n; ++i) {
| ^
a.cc:92:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
92 | for (RI i = 1; i <= 2 * MaxNode; ++i)
| ^
a.cc:94:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
94 | for (RI i = 1; i <= n; ++i)
| ^
a.cc: In function 'int main()':
a.cc:107:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
107 | for (RI i = 1; i <= n; ++i)
| ^
a.cc:110:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
110 | for (RI i = 1; i <= _2n; ++i) {
| ^
/tmp/ccwhrkuc.o: in function `Tarjan(int)':
a.cc:(.text+0x2ae): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccwhrkuc.o
a.cc:(.text+0x2b7): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccwhrkuc.o
a.cc:(.text+0x2bd): relocation truncated to fit: R_X86_64_PC32 against symbol `cnt' defined in .bss section in /tmp/ccwhrkuc.o
a.cc:(.text+0x301): relocation truncated to fit: R_X86_64_PC32 against symbol `Low' defined in .bss section in /tmp/ccwhrkuc.o
a.cc:(.text+0x30d): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccwhrkuc.o
a.cc:(.text+0x316): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccwhrkuc.o
a.cc:(.text+0x31c): relocation truncated to fit: R_X86_64_PC32 against symbol `top' defined in .bss section in /tmp/ccwhrkuc.o
a.cc:(.text+0x32e): relocation truncated to fit: R_X86_64_PC32 against symbol `stk' defined in .bss section in /tmp/ccwhrkuc.o
a.cc:(.text+0x342): relocation truncated to fit: R_X86_64_PC32 against symbol `stk' defined in .bss section in /tmp/ccwhrkuc.o
a.cc:(.text+0x35a): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccwhrkuc.o
a.cc:(.text+0x3ec): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s228825212 | p03802 | C++ | #include <bits/stdc++.h>
using namespace std;
// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define sort_by(x, y) sort(all(x), [&](const auto& a, const auto& b) { return y; })
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;
template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
namespace __input {
template<class T1, class T2> void re(pair<T1,T2>& p);
template<class T> void re(vector<T>& a);
template<class T, size_t SZ> void re(array<T,SZ>& a);
template<class T> void re(T& x) { cin >> x; }
void re(double& x) { string t; re(t); x = stod(t); }
template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
re(first); re(rest...);
}
template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}
using namespace __input;
namespace __output {
template<class T1, class T2> void pr(const pair<T1,T2>& x);
template<class T, size_t SZ> void pr(const array<T,SZ>& x);
template<class T> void pr(const vector<T>& x);
template<class T> void pr(const set<T>& x);
template<class T1, class T2> void pr(const map<T1,T2>& x);
template<class T> void pr(const T& x) { cout << x; }
template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
pr(first); pr(rest...);
}
template<class T1, class T2> void pr(const pair<T1,T2>& x) {
pr("{",x.f,", ",x.s,"}");
}
template<class T, bool pretty = true> void prContain(const T& x) {
if (pretty) pr("{");
bool fst = 1; for (const auto& a: x) pr(!fst?pretty?", ":" ":"",a), fst = 0;
if (pretty) pr("}");
}
template<class T> void pc(const T& x) { prContain<T, false>(x); pr("\n"); }
template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
template<class T> void pr(const vector<T>& x) { prContain(x); }
template<class T> void pr(const set<T>& x) { prContain(x); }
template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }
void ps() { pr("\n"); }
template<class Arg> void ps(const Arg& first) {
pr(first); ps();
}
template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
pr(first," "); ps(rest...);
}
}
using namespace __output;
#define TRACE(x) x
#define __pn(x) pr(#x, " = ")
#define pd(...) __pn((__VA_ARGS__)), ps(__VA_ARGS__), cout << flush
namespace __algorithm {
template<typename T> void dedup(vector<T>& v) {
sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> typename vector<T>::iterator find(vector<T>& v, const T& x) {
auto it = lower_bound(all(v), x); return it != v.end() && *it == x ? it : v.end();
}
template<typename T> size_t index(vector<T>& v, const T& x) {
auto it = find(v, x); assert(it != v.end() && *it == x); return it - v.begin();
}
template<typename C, typename T> vector<T> prefixes(const C& v, T zero) {
vector<T> res(sz(v) + 1, zero); F0R (i, sz(v)) res[i+1] = res[i] + v[i]; return res;
}
template<typename C, typename T> vector<T> suffixes(const C& v, T zero) {
vector<T> res(sz(v) + 1, zero); F0Rd (i, sz(v)) res[i] = v[i] + res[i+1]; return res;
}
}
using namespace __algorithm;
struct monostate {
friend istream& operator>>(istream& is, const __attribute__((unused))monostate& ms) { return is; }
friend ostream& operator<<(ostream& os, const __attribute__((unused))monostate& ms) { return os; }
} ms;
template<typename W=monostate> struct wedge {
int u, v, i; W w;
wedge<W>(int _u=-1, int _v=-1, int _i=-1) : u(_u), v(_v), i(_i) {}
int operator[](int loc) const { return u ^ v ^ loc; }
friend void re(wedge& e) { re(e.u, e.v, e.w); --e.u, --e.v; }
friend void pr(const wedge& e) { pr(e.u, "<-", e.w, "->", e.v); }
};
namespace __io {
void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void setIO(string s = "") {
ios_base::sync_with_stdio(0); cin.tie(0); cout.precision(15);
if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
}
}
using namespace __io;
// }}}
tuple<int, vi> strongly_connected_components(const vvi& graph) {
const int N = graph.size();
int C = 0, V = 0, top = 0;
vi comp(N, -1), inx(N, -1), stack(N + 1, -1);
auto tarjan = [&](auto&& self, int loc) -> int {
stack[top++] = loc;
int low = inx[loc] = V++;
for (int nbr : graph[loc]) {
if (inx[nbr] == -1) low = min(low, self(self, nbr));
else if (comp[nbr] == -1) low = min(low, inx[nbr]);
}
if (low == inx[loc]) {
while (stack[top] != loc)
comp[stack[--top]] = C;
C++;
}
return low;
};
for (int i = 0; i < N; i++) {
if (inx[i] == -1)
tarjan(tarjan, i);
}
return { C, comp };
}
int main() {
setIO();
int N; re(N); vpii locs(N); re(locs);
vpii neg;
F0R (i, N) {
neg.eb(locs[i].f, 2 * i);
neg.eb(locs[i].s, 2 * i + 1);
}
sort(all(neg));
vi index(2 * N); F0R (i, 2 * N) index[neg[i].s] = i;
int ans = 0, lo = 1, hi = 1e9;
while (lo <= hi) {
int mi = (lo + hi) / 2;
vvi adj(4 * N);
FOR (v, 1, 2 * N) {
adj[v].pb(2 * v);
adj[v].pb(2 * v + 1);
}
auto ins = [&](int i, int l, int r) {
for (i += 2 * N, l += 2 * N, r += 2 * N; l < r; l /= 2, r /= 2) {
if (l&1) adj[i].pb(l++);
if (r&1) adj[i].pb(--r);
}
};
F0R (f, 2 * N) {
int l = neg[f].f;
int i = lb(all(neg), mp(l - mi + 1, -1)) - neg.begin();
int j = lb(all(neg), mp(l + mi, -1)) - neg.begin();
ins(index[neg[f].s^1], i, f);
ins(index[neg[f].s^1], f+1, j);
}
bool ok = true;
vi scc = get<1>(strongly_connected_components(adj));
F0R (f, N) ok &= scc[2 * N + index[2 * f]] != scc[2 * N + index[2 * f + 1]];
if (ok) ans = mi, lo = mi + 1;
else hi = mi - 1;
}
ps(ans);
return 0;
}
| a.cc:133:21: error: reference to 'monostate' is ambiguous
133 | template<typename W=monostate> struct wedge {
| ^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
from a.cc:1:
/usr/include/c++/14/variant:1237:10: note: candidates are: 'struct std::monostate'
1237 | struct monostate { };
| ^~~~~~~~~
a.cc:128:8: note: 'struct monostate'
128 | struct monostate {
| ^~~~~~~~~
|
s921226099 | p03802 | C++ | #include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
#define pii pair <int, int>
#define X first
#define Y second
using namespace std;
const int OFF = (1 << 15);
vector <int> ve[OFF * 2];
int bio[2 * OFF], low[2 * OFF], scc[2 * OFF];
int cnt = 0, ind = 0, n;
stack <int> st;
int on_stack[2 * OFF];
int index[2 * OFF];
vector <pii> tmp;
void dfs(int x) {
bio[x] = low[x] = cnt++;
st.push(x);
on_stack[x] = 1;
for (int y : ve[x]) {
if (bio[y] == -1) {
dfs(y);
low[x] = min(low[x], low[y]);
} else if (on_stack[y]) {
low[x] = min(low[x], bio[y]);
}
}
if (low[x] == bio[x]) {
while (st.size()) {
int y = st.top();
st.pop();
on_stack[y] = 0;
scc[y] = ind;
if (y == x) break;
}
ind++;
}
return;
}
void tarjan(int N) {
cnt = 1, ind = 0;
memset(scc, -1, sizeof scc);
memset(bio, -1, sizeof bio);
REP(i, N) {
if (bio[i] == -1) dfs(i);
}
return;
}
void connect(int a, int b, int k, int lo = 0, int hi = OFF, int x = 1) {
if (b <= lo || hi <= a) return;
if (a <= lo && hi <= b) {
ve[k].push_back(x);
return;
}
int mi = (lo + hi) / 2;
connect(a, b, k, lo, mi, x * 2);
connect(a, b, k, mi, hi, x * 2 + 1);
return;
}
void generate(int D) {
REP(i, OFF) ve[i + OFF].clear();
int l = 0, r = 0;
REP(i, 2 * n) {
while (tmp[l].X < tmp[i].X - D) l++;
while (r < 2 * n && tmp[r].X <= tmp[i].X + D) r++;
connect(l + 2 * n, i + 2 * n, i + OFF);
connect(i + 1 + 2 * n, r + 2 * n, i + OFF);
}
REP(i, n) {
int a = index[2 * i];
int b = index[2 * i + 1];
ve[a + OFF].push_back(b + 2 * n + OFF);
ve[b + OFF].push_back(a + 2 * n + OFF);
ve[b + 2 * n + OFF].push_back(a + OFF);
ve[a + 2 * n + OFF].push_back(b + OFF);
}
return;
}
bool check(int mi) {
generate(mi);
tarjan(2 * OFF);
bool flag = 1;
REP(i, 2 * n) {
if (scc[i + OFF] == scc[i + 2 * n + OFF]) flag = 0;
}
return flag;
}
int main() {
ios_base::sync_with_stdio(false);
FOR(i, 1, OFF) {
ve[i].push_back(i * 2);
ve[i].push_back(i * 2 + 1);
}
cin >> n;
REP(i, 2 * n) {
int a;
cin >> a;
tmp.push_back({a, i});
}
sort(tmp.begin(), tmp.end());
REP(i, 2 * n) index[tmp[i].Y] = i;
/*
generate(3);
FOR(i, OFF, 2 * OFF) {
cout << i << ": ";
for (int x : ve[i]) cout << x << " ";
cout << endl;
}
tarjan(2 * OFF);
REP(i, 2 * n) {
cout << scc[i + OFF] << " " << scc[i + 2 * n + OFF] << endl;
}
*/
int lo = 0, hi = 1e9;
while (lo < hi) {
int mi = (lo + hi + 1) / 2;
if (check(mi)) lo = mi;
else hi = mi - 1;
}
if (lo == 0 && !check(0)) cout << 0 << endl;
else cout << lo + 1 << endl;
return 0;
} | a.cc:18:18: error: 'int index [65536]' redeclared as different kind of entity
18 | int index[2 * OFF];
| ^
In file included from /usr/include/string.h:462,
from /usr/include/c++/14/cstring:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
50 | extern const char *index (const char *__s, int __c)
| ^~~~~
a.cc: In function 'void generate(int)':
a.cc:88:18: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
88 | int a = index[2 * i];
| ^
a.cc:89:18: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
89 | int b = index[2 * i + 1];
| ^
a.cc: In function 'int main()':
a.cc:127:22: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
127 | REP(i, 2 * n) index[tmp[i].Y] = i;
| ^
|
s683548500 | p03802 | C++ | #include <bits/stdc++.h>
#include <windows.h>
#define il inline
#define ri register int
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define MAXN 100050
#define MAXM
#define MOD
#define INF (1<<25)
#define eps (1e-6)
#define mid ((l+r)>>1)
#define all_edge(u) for(vector <int> :: iterator it = adj[(u)].begin(); it != adj[(u)].end(); ++it)
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair <int, int> pii;
typedef pair <LL, int> pli;
typedef pair <int, LL> pil;
typedef pair <LL, LL> pll;
int n, ver[MAXN][2], dfn[MAXN<<7], low[MAXN<<7], st[MAXN<<7], ins[MAXN<<7], top, idcnt, ccnt, col[MAXN<<7], vcnt;
struct node {
int pos, id, ty;
bool operator < (const node &x) const {
if(pos == x.pos) return id < x.id;
return pos < x.pos;
}
}a[MAXN<<2];
vector <int> adj[MAXN<<7];
void build(int u, int l, int r) {
vcnt = max(vcnt, u+2*n);
if(l == r) return adj[u+2*n].pb(a[l].id + (a[l].ty^1)*n);
build(u<<1, l, mid), build(u<<1|1, mid+1, r);
adj[u+2*n].pb((u<<1)+2*n), adj[u+2*n].pb((u<<1|1)+2*n);
}
void link(int u, int l, int r, int tl, int tr, int p) {
// cout<<u<<' '<<l<<' '<<r<<' '<<tl<<' '<<tr<<' '<<p<<endl;
// Sleep(100);
if(tl > tr) return ;
if(tl <= l && r <= tr) {
// cout<<"link "<<p<<' '<<u+2*n<<endl;
return adj[p].pb(u+2*n);
}
if(tl <= mid) link(u<<1, l, mid, tl, tr, p);
if(mid < tr) link(u<<1|1, mid+1, r, tl, tr, p);
}
void tarjan(int u) {
st[++top] = u, ins[u] = 1;
dfn[u] = low[u] = ++idcnt;
all_edge(u) {
if(!dfn[*it]) tarjan(*it), low[u] = min(low[u], low[*it]);
else if(ins[*it]) low[u] = min(low[u], dfn[*it]);
}
if(low[u] == dfn[u]) {
int cur; ++ccnt;
do {
cur = st[top--], ins[cur] = 0;
col[cur] = ccnt;
} while(cur != u);
}
}
bool check(int x) {
int L, R; idcnt = ccnt = 0;
for(ri i = 1; i <= n*2; ++i) adj[i].clear();
for(ri i = 1; i <= vcnt; ++i) dfn[i] = low[i] = col[i] = 0;
// cout<<"Checking dis of "<<x<<endl;
for(ri i = 1; i <= n; ++i) {
// cerr<<i<<endl;
for(ri k = 0; k <= 1; ++k) {
L = lower_bound(a+1, a+n*2+1, node {ver[i][k]-x+1, 0, 0})-a, R = lower_bound(a+1, a+n*2+1, node {ver[i][k]+x, 0, 0})-a-1;
int pos = lower_bound(a+1, a+n*2+1, node {ver[i][k], i, 0})-a;
// cerr<<ver[i][k]<<' '<<L<<' '<<pos<<' '<<R<<endl;
link(1, 1, n*2, L, pos-1, i+k*n);
// cerr<<"KUAIKULE"<<endl;
link(1, 1, n*2, pos+1, R, i+k*n);
// cerr<<"KELIAN"<<endl;
}
}
for(ri i = 1; i <= n*2; ++i) if(!dfn[i]) tarjan(i);
for(ri i = 1; i <= n; ++i) {
if(col[i] == col[i+n]) return 0;
}
return 1;
}
int main() {
// freopen("1.out", "w", stdout);
scanf("%d", &n);
for(ri i = 1; i <= n; ++i)
scanf("%d%d", &ver[i][0], &ver[i][1]), a[i*2-1] = node {ver[i][0], i, 0}, a[i*2] = node {ver[i][1], i, 1};
sort(a+1, a+n*2+1);
// for(ri i = 1; i <= n*2; ++i) cout<<a[i].pos<<' '<<a[i].id<<' '<<a[i].ty<<endl;
build(1, 1, n*2);
int l = 0, r = 1e9, ans = 0;
while(l <= r) {
if(check(mid)) ans = mid, l = mid+1;
else r = mid-1;
}
printf("%d", ans);
return 0;
} | a.cc:2:10: fatal error: windows.h: No such file or directory
2 | #include <windows.h>
| ^~~~~~~~~~~
compilation terminated.
|
s369339638 | p03802 | C++ | #include<stack>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,tot,etot,ans,_clock,cnt,head[100010],to[800010],nxt[800010],scc[100010],low[100010],dfn[100010],idx[80010];
stack<int>Stack;
struct node{
int idx,val;
friend bool operator<(node a,node b){
return a.val<b.val;
}
}a[20010];
int rd(){
int x=0;
char c;
do c=getchar();
while(!isdigit(c));
do{
x=(x<<1)+(x<<3)+(c^48);
c=getchar();
}while(isdigit(c));
return x;
}
void add_edge(int u,int v){
nxt[++tot]=head[u];
to[tot]=v;
head[u]=tot;
return;
}
void build(int o,int l,int r){
if(l==r){
idx[o]=a[l].idx+(n<<1);
return;
}
idx[o]=++etot;
int mid=(l+r)>>1;
build(o<<1,l,mid);
build(o<<1|1,mid+1,r);
add_edge(idx[o],idx[o<<1]);
add_edge(idx[o],idx[o<<1|1]);
return;
}
void update(int o,int l,int r,int L,int R,int u){
if(L<=l&&r<=R){
add_edge(u,idx[o]);
return;
}
int mid=(l+r)>>1;
if(L<=mid)
update(o<<1,l,mid,L,R,u);
if(R>mid)
update(o<<1|1,mid+1,r,L,R,u);
return;
}
void tarjan(int u){
low[u]=dfn[u]=++_clock;
Stack.push(u);
for(int i=head[u];~i;i=nxt[i]){
int v=to[i];
if(!dfn[v]){
tarjan(v);
low[u]=min(low[u],low[v]);
}
else
if(!scc[v])
low[u]=min(low[u],dfn[v]);
}
if(low[u]==dfn[u]){
cnt++;
int x;
do{
x=Stack.top();
Stack.pop();
scc[x]=cnt;
}while(x!=u);
}
return;
}
bool check(int m){
memset(head,-1,sizeof(head));
memset(scc,0,sizeof(scc));
memset(low,0,sizeof(low));
memset(dfn,0,sizeof(dfn));
tot=0;
_clock=0;
cnt=0;
etot=(n<<2);
build(1,1,n<<1);
int l=1,r=1;
for(int i=1;i<=n;i++){
add_edge(i,i+n+(n<<1));
add_edge(i+n+(n<<1),i);
add_edge(i+(n<<1),i+n);
add_edge(i+n,i+(n<<1));
}
for(int i=1;i<=(n<<1);i++){
while(a[i].val-a[l].val+1>m&&l<i)
l++;
while(a[r+1].val-a[i].val+1<=m&&r<(n<<1))
r++;
if(l<i)
update(1,1,(n<<1),l,i-1,a[i].idx);
if(i<r)
update(1,1,(n<<1),i+1,r,a[i].idx);
}
for(int i=1;i<=(n<<1);i++)
if(!scc[i])
tarjan(i);
for(int i=1;i<=(n<<1);i++)
if(scc[i]==scc[i+(n<<1)])
return 0;
return 1;
}
int main(){
n=rd();
for(int i=1;i<=n;i++){
a[i].val=rd();
a[i+n].val=rd();
}
for(int i=1;i<=(n<<1);i++)
a[i].idx=i;
sort(a+1,a+(n<<1)+1);
int l=0,r=1e9;
while(l<=r){
int mid=(l+r)>>1;
if(check(mid)){
ans=mid;
l=mid+1;
}
else r=mid-1;
}
printf("%d",ans);
return 0;
} | a.cc: In function 'int rd()':
a.cc:18:16: error: 'isdigit' was not declared in this scope
18 | while(!isdigit(c));
| ^~~~~~~
|
s114541647 | p03802 | C++ |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define llu unsigned long long
#define ld double
#define llu unsigned long long
#define rep(i,x,y) for(ll i=(ll)(x);i<(ll)(y);++i)
#define For(i,x,y) for(ll i=(ll)(x);i<=(ll)(y);++i)
#define FOr(i,x,y) for(ll i=(ll)(x);i>=(ll)(y);--i)
#define pi acos(-1)
#define mk make_pair
#define pa pair<ll,ll>
#define lf else if
#define IL inline
#define max(x,y) ((x)<(y)?(y):(x))
#define min(x,y) ((x)<(y)?(x):(y))
#define sqr(x) ((x)*(x))
#define Mul(x,y) ((x)=1LL*(x)*(y)%mod)
#define Add(x,y) ((x)=((x)+(y))%mod)
#define E(x) return writeln(x),0
#define LL (long long)
#define p(x) printf("~%lld~\n",LL(x))
#define pp(x,y) printf("~~%lld %lld~~\n",LL(x),LL(y))
#define ppp(x,y,z) printf("~~~%lld %lld %lld~~~\n",LL(x),LL(y),LL(z))
#define pppp(a,b,c,d) printf("~~~%lld %lld %lld %lld\n",LL(a),LL(b),LL(c),LL(d))
#define f_in(x) freopen(x".in","r",stdin)
#define f_out(x) freopen(x".out","w",stdout)
#define open(x) f_in(x),f_out(x)
#define fi first
#define se second
#define GuYue puts("\nGuYueNa________________________________________________________________________________")
#define y1 fafa____
typedef complex<double> E;
namespace SHENZHEBEI{
#ifdef LOCAL
struct _{_(){freopen("cf.in","r",stdin);}}_;
#endif
#define NEG 1
static const int GYN=2333333;
char SZB[GYN],*S=SZB,*T=SZB;
inline char gc(){ if (S==T){ T=(S=SZB)+fread(SZB,1,GYN,stdin); if (S==T) return '\n'; } return *S++; }
#if NEG
inline ll read(){ ll x=0,g=1; char ch=gc(); for (;!isdigit(ch);ch=gc()) if (ch=='-') g=-1; for (;isdigit(ch);ch=gc()) x=x*10-48+ch; return x*g; }
inline void write(ll x){ if (x<0) putchar('-'),x=-x; if (x>=10) write(x/10); putchar(x%10+'0'); }
#else
inline ll read(){ ll x=0; char ch=gc(); for (;!isdigit(ch);ch=gc()); for (;isdigit(ch);ch=gc()) x=x*10-48+ch; return x; }
inline void write(ll x){ if (x>=10) write(x/10); putchar(x%10+'0'); }
#endif
inline char readchar(){ char ch=gc(); for(;isspace(ch);ch=gc()); return ch; }
inline ll readstr(char *s){ char ch=gc(); int cur=0; for(;isspace(ch);ch=gc()); for(;!isspace(ch);ch=gc()) s[cur++]=ch; s[cur]='\0'; return cur; }
void Print(long long *a,int s,int t){For(i,s,t)printf("%lld ",a[i]);puts("");}
void Print(int *a,int s,int t){For(i,s,t)printf("%d ",a[i]);puts("");}
void Print(char *a,int s,int t){For(i,s,t)putchar(a[i]);puts("");}
void writeln(ll x){write(x);putchar('\n');}
}using namespace SHENZHEBEI;
void build(ll l,ll r,ll &p){
if (l==r){
p=id[l]; mn[p]=mx[p]=a[l];
return;
}p=++cnt;
ll mid=(l+r)>>1;
build(l,mid,ls[p]);
build(mid+1,r,rs[p]);
g[p].push_back(ls[p]);
g[p].push_back(rs[p]);
mx[p]=max(mx[ls[p]],mx[rs[p]]);
mn[p]=min(mn[ls[p]],mn[rs[p]]);
}
bool check(ll len){
cnt=n*2;
For(i,1,n) a[i]=x[i],id[i]=i+n;
build(1,n,Rt);
For(i,1,n)AddEdge(x[i]-len,x[i]+len,i);
For(i,1,n) a[i]=y[i],id[i]=i;
build(1,n,1);
For(i,1,n)AddEdge(y[i]-len,y[i]+len,i+n);
}
int main(){
n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
sort(q1+1,q1+top1+1);sort(q2+1,q2+top2+1);
For(i,1,n) x[i]=lower_bound(q1+1,q1+top1+1,x[i])-q1,
y[i]=lower_bound(q2+1,q2+top2+1,y[i])-q2;
ll l=0,r=2e9,mid;
for(;l<=r;){
mid=(l+r)/2;
if (check(mid))ans=mid,l=mid+1;
else r=mid-1;
}writeln(ans);
} | a.cc: In function 'void build(long long int, long long int, long long int&)':
a.cc:60:19: error: 'id' was not declared in this scope; did you mean 'ld'?
60 | p=id[l]; mn[p]=mx[p]=a[l];
| ^~
| ld
a.cc:60:33: error: 'mn' was not declared in this scope; did you mean 'yn'?
60 | p=id[l]; mn[p]=mx[p]=a[l];
| ^~
| yn
a.cc:60:39: error: 'mx' was not declared in this scope; did you mean 'max'?
60 | p=id[l]; mn[p]=mx[p]=a[l];
| ^~
| max
a.cc:60:45: error: 'a' was not declared in this scope
60 | p=id[l]; mn[p]=mx[p]=a[l];
| ^
a.cc:62:14: error: 'cnt' was not declared in this scope; did you mean 'int'?
62 | }p=++cnt;
| ^~~
| int
a.cc:64:21: error: 'ls' was not declared in this scope; did you mean 'l'?
64 | build(l,mid,ls[p]);
| ^~
| l
a.cc:65:23: error: 'rs' was not declared in this scope; did you mean 'r'?
65 | build(mid+1,r,rs[p]);
| ^~
| r
a.cc:66:9: error: 'g' was not declared in this scope
66 | g[p].push_back(ls[p]);
| ^
a.cc:68:9: error: 'mx' was not declared in this scope; did you mean 'max'?
68 | mx[p]=max(mx[ls[p]],mx[rs[p]]);
| ^~
| max
a.cc:69:9: error: 'mn' was not declared in this scope; did you mean 'yn'?
69 | mn[p]=min(mn[ls[p]],mn[rs[p]]);
| ^~
| yn
a.cc: In function 'bool check(long long int)':
a.cc:72:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
72 | cnt=n*2;
| ^~~
| int
a.cc:72:13: error: 'n' was not declared in this scope; did you mean 'yn'?
72 | cnt=n*2;
| ^
| yn
a.cc:73:25: error: 'a' was not declared in this scope
73 | For(i,1,n) a[i]=x[i],id[i]=i+n;
| ^
a.cc:73:30: error: 'x' was not declared in this scope
73 | For(i,1,n) a[i]=x[i],id[i]=i+n;
| ^
a.cc:73:35: error: 'id' was not declared in this scope; did you mean 'i'?
73 | For(i,1,n) a[i]=x[i],id[i]=i+n;
| ^~
| i
a.cc:74:19: error: 'Rt' was not declared in this scope
74 | build(1,n,Rt);
| ^~
a.cc:75:27: error: 'x' was not declared in this scope
75 | For(i,1,n)AddEdge(x[i]-len,x[i]+len,i);
| ^
a.cc:75:19: error: 'AddEdge' was not declared in this scope
75 | For(i,1,n)AddEdge(x[i]-len,x[i]+len,i);
| ^~~~~~~
a.cc:77:25: error: 'a' was not declared in this scope
77 | For(i,1,n) a[i]=y[i],id[i]=i;
| ^
a.cc:77:30: error: 'y' was not declared in this scope
77 | For(i,1,n) a[i]=y[i],id[i]=i;
| ^
a.cc:77:35: error: 'id' was not declared in this scope; did you mean 'i'?
77 | For(i,1,n) a[i]=y[i],id[i]=i;
| ^~
| i
a.cc:79:27: error: 'y' was not declared in this scope
79 | For(i,1,n)AddEdge(y[i]-len,y[i]+len,i+n);
| ^
a.cc:79:19: error: 'AddEdge' was not declared in this scope
79 | For(i,1,n)AddEdge(y[i]-len,y[i]+len,i+n);
| ^~~~~~~
a.cc:81:1: warning: no return statement in function returning non-void [-Wreturn-type]
81 | }
| ^
a.cc: In function 'int main()':
a.cc:83:9: error: 'n' was not declared in this scope; did you mean 'yn'?
83 | n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
| ^
| yn
a.cc:83:28: error: 'x' was not declared in this scope
83 | n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
| ^
a.cc:83:40: error: 'y' was not declared in this scope
83 | n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
| ^
a.cc:83:52: error: 'q1' was not declared in this scope; did you mean 'y1'?
83 | n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
| ^~
| y1
a.cc:83:57: error: 'top1' was not declared in this scope
83 | n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
| ^~~~
a.cc:83:68: error: 'q2' was not declared in this scope
83 | n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
| ^~
a.cc:83:73: error: 'top2' was not declared in this scope
83 | n=read();For(i,1,n)x[i]=read(),y[i]=read(),q1[++top1]=x[i],q2[++top2]=y[i];
| ^~~~
a.cc:84:14: error: 'q1' was not declared in this scope; did you mean 'y1'?
84 | sort(q1+1,q1+top1+1);sort(q2+1,q2+top2+1);
| ^~
| y1
a.cc:84:22: error: 'top1' was not declared in this scope
84 | sort(q1+1,q1+top1+1);sort(q2+1,q2+top2+1);
| ^~~~
a.cc:84:35: error: 'q2' was not declared in this scope
84 | sort(q1+1,q1+top1+1);sort(q2+1,q2+top2+1);
| ^~
a.cc:84:43: error: 'top2' was not declared in this scope
84 | sort(q1+1,q1+top1+1);sort(q2+1,q2+top2+1);
| ^~~~
a.cc:85:25: error: 'x' was not declared in this scope
85 | For(i,1,n) x[i]=lower_bound(q1+1,q1+top1+1,x[i])-q1,
| ^
a.cc:86:33: error: 'y' was not declared in this scope
86 | y[i]=lower_bound(q2+1,q2+top2+1,y[i])-q2;
| ^
a.cc:90:32: error: 'ans' was not declared in this scope; did you mean 'abs'?
90 | if (check(mid))ans=mid,l=mid+1;
| ^~~
| abs
a.cc:92:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
92 | }writeln(ans);
| ^~~
| abs
|
s456028534 | p03802 | C++ | #include<bits/stdc++.h>
#define maxn 10005
using namespace std;
typedef long long LL;
int read()
{
char c;int sum=0,f=1;c=getchar();
while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0' && c<='9'){sum=sum*10+c-'0';c=getchar();}
return sum*f;
}
int n;
struct node{
int x,id,rev;
friend bool operator <(node a,node b){return a.x<b.x;}
}d[maxn*2];
int a[maxn],b[maxn],c[maxn*2];
int leaf[maxn*2],lson[maxn*100],rson[maxn*100],tot;
int head[maxn*2],to[maxn*4],nex[maxn*4],cnt,num;
int root,top,sum,index,s[maxn*2],dfn[maxn*2],low[maxn*2],bel[maxn*2];
bool vis[maxn*2];
void add(int u,int v)
{
to[++cnt]=v;
nex[cnt]=head[u];
head[u]=cnt;
}
void build(int &x,int l,int r)
{
if(!x) x=++tot;
if(l==r)
{
leaf[l]=x;
return;
}
int mid=(l+r)>>1;
build(lson[x],l,mid);build(rson[x],mid+1,r);
}
void connect(int x,int l,int r)
{
if(l==r) return;
add(x,lson[x]);add(x,rson[x]);
int mid=(l+r)>>1;
connect(lson[x],l,mid);connect(rson[x],mid+1,r);
}
void insert(int x,int l,int r,int ql,int qr,int id)
{
if(ql>qr) return;
if(l==ql && qr==r)
{
add(id,x);
return;
}
int mid=(l+r)>>1;
if(qr<=mid) insert(lson[x],l,mid,ql,qr,id);
else if(ql>mid) insert(rson[x],mid+1,r,ql,qr,id);
else insert(lson[x],l,mid,ql,mid,id),insert(rson[x],mid+1,r,mid+1,qr,id);
}
void ins(int id,int x,int dis)
{
int L,R,l,r,mid;
l=x;r=2*n;
while(l<r)
{
mid=(l+r+1)/2;
if(c[mid]-c[x]<dis) l=mid;
else r=mid-1;
}
R=l;
l=1;r=x;
while(l<r)
{
mid=(l+r)/2;
if(c[x]-c[mid]<dis) r=mid;
else l=mid+1;
}
L=l;
insert(root,1,2*n,L,x-1,id);
insert(root,1,2*n,x+1,R,id);
}
void tarjan(int x)
{
s[++top]=x;
dfn[x]=low[x]=++index;
vis[x]=1;
for(int i=head[x];i;i=nex[i])
{
if(!dfn[to[i]])
{
tarjan(to[i]);
low[x]=min(low[x],low[to[i]]);
}
else if(vis[to[i]])
low[x]=min(low[x],dfn[to[i]]);
}
if(dfn[x]==low[x])
{
sum++;
do
{
vis[s[top]]=0;bel[s[top]]=sum;
top--;
}
while(s[top+1]!=x);
}
}
bool check(int x)
{
cnt=0;
memset(head,0,sizeof(head));
connect(root,1,2*n);
for(int i=1;i<=n;i++)
{
add(leaf[b[i]],i*2-1);
add(leaf[a[i]],i*2);
ins(i*2-1,a[i],x);
ins(i*2,b[i],x);
}
top=index=sum=0;
memset(vis,0,sizeof(vis));
memset(dfn,0,sizeof(dfn));
memset(low,0,sizeof(low));
for(int i=1;i<=num;i++)
if(!dfn[i]) tarjan(i);
for(int i=1;i<=n;i++)
if(bel[i*2-1]==bel[i*2]) return false;
return true;
}
int main()
{
n=read();
for(int i=1;i<=n;i++)
{
a[i]=read(),b[i]=read();
d[i*2-1].x=a[i];d[i*2-1].rev=0;
d[i*2].x=b[i];d[i*2].rev=1;
d[i*2-1].id=d[i*2].id=i;
}
sort(d+1,d+2*n+1);
for(int i=1;i<=2*n;i++)
{
if(!d[i].rev) a[d[i].id]=i;
else b[d[i].id]=i;
c[i]=d[i].x;
}
tot=2*n;
build(root,1,2*n);
num=tot;
int l=0,r=1000000000,mid;
while(l<r)
{
mid=(l+r+1)/2;
if (check(mid)) l=mid;else r=mid-1;
}
printf("%d\n",l);
return 0;
} | a.cc:20:18: error: 'int index' redeclared as different kind of entity
20 | int root,top,sum,index,s[maxn*2],dfn[maxn*2],low[maxn*2],bel[maxn*2];
| ^~~~~
In file included from /usr/include/string.h:462,
from /usr/include/c++/14/cstring:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
50 | extern const char *index (const char *__s, int __c)
| ^~~~~
a.cc: In function 'void tarjan(int)':
a.cc:84:25: error: no pre-increment operator for type
84 | dfn[x]=low[x]=++index;
| ^~~~~
a.cc: In function 'bool check(int)':
a.cc:119:23: error: overloaded function with no contextual type information
119 | top=index=sum=0;
| ^
|
s691610988 | p03802 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define rep(i,a) for(int i=last[a];i;i=next[i])
using namespace std;
int read() {
char ch;
for(ch=getchar();ch<'0'||ch>'9';ch=getchar());
int x=ch-'0';
for(ch=getchar();ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
return x;
}
const int N=1e6+5,inf=1e9;
struct pty{int x,y,id;}a[N],b[N];
bool cmpx(pty a,pty b) {return a.x<b.x;}
bool cmpy(pty a,pty b) {return a.y<b.y;}
int last[N],now[N],next[N],t[N],l,cnt;
void add(int x,int y) {
t[++l]=y;next[l]=last[x];last[x]=l;
}
int n,tot;
void init() {
n=read();tot=2*n;
fo(i,1,n) {
a[i].x=read();a[i].y=read();a[i].id=i;
b[i].x=a[i].x;b[i].y=a[i].y;b[i].id=i;
}
}
int rootx,rooty,le[N],ri[N];
void build(int &v,int l,int r,int flag) {
if (l==r) {
v=(flag==1)?(a[l].id+n):b[l].id;
return;
}
v=++tot;
int mid=l+r>>1;
build(le[v],l,mid,flag);
build(ri[v],mid+1,r,flag);
add(v,le[v]);add(v,ri[v]);
}
void link(int v,int l,int r,int x,int y,int z) {
if (x>y) return;
if (l==x&&r==y) {add(z,v);return;}
int mid=l+r>>1;
if (y<=mid) link(le[v],l,mid,x,y,z);
else if (x>mid) link(ri[v],mid+1,r,x,y,z);
else link(le[v],l,mid,x,mid,z),link(ri[v],mid+1,r,mid+1,y,z);
}
void prepare() {
sort(a+1,a+n+1,cmpx);
build(rootx,1,n,1);
sort(b+1,b+n+1,cmpy);
build(rooty,1,n,2);
fo(i,1,tot) now[i]=last[i];cnt=l;
}
int dfn[N],low[N],stack[N],cl[N],tmp,top,id;
bool vis[N],in[N];
void tarjan(int x) {
vis[x]=in[x]=1;dfn[x]=low[x]=++tmp;stack[++top]=x;
rep(i,x)
if (!vis[t[i]]) {
tarjan(t[i]);
low[x]=min(low[x],low[t[i]]);
} else if (in[t[i]]) low[x]=min(low[x],dfn[t[i]]);
if (low[x]==dfn[x]) {
stack[top+1]=0;++id;
for(;stack[top+1]!=x;top--) {
in[stack[top]]=0;
cl[stack[top]]=id;
}
}
}
bool check(int mid) {
int lx,rx;
fo(i,1,tot) last[i]=now[i];l=cnt;
lx=1,rx=1;
fo(i,1,n) {
while (lx<i&&a[i].x-a[lx].x>=mid) lx++;
while (rx<=n&&a[rx].x-a[i].x<mid) rx++;
link(rootx,1,n,lx,i-1,a[i].id);
link(rootx,1,n,i+1,rx-1,a[i].id);
}
// xuan x ban x
lx=1,rx=1;
fo(i,1,n) {
while (lx<=n&&b[i].y-a[lx].x>=mid) lx++;
while (rx<=n&&a[rx].x-b[i].y<mid) rx++;
link(rootx,1,n,lx,rx-1,b[i].id+n);
}
// xuan y ban x
lx=1,rx=1;
fo(i,1,n) {
while (lx<=n&&a[i].x-b[lx].y>=mid) lx++;
while (rx<=n&&b[rx].y-a[i].x<mid) rx++;
link(rooty,1,n,lx,rx-1,a[i].id);
}
// xuan x ban y
lx=1,rx=1;
fo(i,1,n) {
while (lx<i&&b[i].y-b[lx].y>=mid) lx++;
while (rx<=n&&b[rx].y-b[i].y<mid) rx++;
link(rooty,1,n,lx,i-1,b[i].id+n);
link(rooty,1,n,i+1,rx-1,b[i].id+n);
}
// xuan y ban y
tmp=top=id=0;
fo(i,1,tot) vis[i]=cl[i]=dfn[i]=low[i]=0;
fo(i,1,tot) if (!vis[i]) tarjan(i);
fo(i,1,n) if (cl[i]==cl[i+n]) return 0;
return 1;
}
void solve() {
int l=0,r=inf;
while (l<r) {
int mid=l+r>>1;
if (check(mid)) l=mid+1;
else r=mid;
}
printf("%d\n",l-1);
}
int main() {
init();
prepare();
solve();
return 0;
} | a.cc: In function 'void add(int, int)':
a.cc:25:18: error: reference to 'next' is ambiguous
25 | t[++l]=y;next[l]=last[x];last[x]=l;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
from /usr/include/c++/14/algorithm:60,
from a.cc:3:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:23:20: note: 'int next [1000005]'
23 | int last[N],now[N],next[N],t[N],l,cnt;
| ^~~~
a.cc: In function 'void tarjan(int)':
a.cc:6:40: error: reference to 'next' is ambiguous
6 | #define rep(i,a) for(int i=last[a];i;i=next[i])
| ^~~~
a.cc:71:9: note: in expansion of macro 'rep'
71 | rep(i,x)
| ^~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:23:20: note: 'int next [1000005]'
23 | int last[N],now[N],next[N],t[N],l,cnt;
| ^~~~
|
s289561545 | p03802 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define rep(i,a) for(int i=last[a];i;i=next[i])
using namespace std;
int read() {
char ch;
for(ch=getchar();ch<'0'||ch>'9';ch=getchar());
int x=ch-'0';
for(ch=getchar();ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
return x;
}
const int N=1e6+5,inf=1e9;
struct pty{int x,y,id;}a[N],b[N];
bool cmpx(pty a,pty b) {return a.x<b.x;}
bool cmpy(pty a,pty b) {return a.y<b.y;}
int last[N],now[N],next[N],t[N],l,cnt;
void add(int x,int y) {
t[++l]=y;next[l]=last[x];last[x]=l;
}
namespace Prog2{
const int N = 10010;
int m=0,n;
int v[N<<1],f[N<<1];
inline bool ok(int x){
v[0]=-1e9;
memset(f,0,sizeof f); f[0]=0;
int j=1;
for(int i=1;i<=m;++i){
// j=lower_bound(v,v+1+m,v[i]-x)-v;
while(v[j]<=v[i]-x) ++j;
if (v[j]>v[i]-x) --j;
f[i]=max(f[i-1],f[j]+1);
}
return f[m]>=n;
}
}
int n,tot;
void init() {
Prog2::n=n=read();Prog2::m=tot=2*n;
fo(i,1,n) {
a[i].x=read();a[i].y=read();a[i].id=i;
b[i].x=a[i].x;b[i].y=a[i].y;b[i].id=i;
Prog2::v[i+i-1]=a[i].x;
Prog2::v[i+i]=a[i].y;
}
}
int rootx,rooty,le[N],ri[N];
void build(int &v,int l,int r,int flag) {
if (l==r) {
v=(flag==1)?(a[l].id+n):b[l].id;
return;
}
v=++tot;
int mid=l+r>>1;
build(le[v],l,mid,flag);
build(ri[v],mid+1,r,flag);
add(v,le[v]);add(v,ri[v]);
}
void link(int v,int l,int r,int x,int y,int z) {
if (x>y) return;
if (l==x&&r==y) {add(z,v);return;}
int mid=l+r>>1;
if (y<=mid) link(le[v],l,mid,x,y,z);
else if (x>mid) link(ri[v],mid+1,r,x,y,z);
else link(le[v],l,mid,x,mid,z),link(ri[v],mid+1,r,mid+1,y,z);
}
void prepare() {
sort(Prog2::v+1,Prog2::v+Prog2::m+1);
sort(a+1,a+n+1,cmpx);
build(rootx,1,n,1);
sort(b+1,b+n+1,cmpy);
build(rooty,1,n,2);
fo(i,1,tot) now[i]=last[i];cnt=l;
}
int dfn[N],low[N],stack[N],cl[N],tmp,top,id;
bool vis[N],in[N];
void tarjan(int x) {
vis[x]=in[x]=1;dfn[x]=low[x]=++tmp;stack[++top]=x;
rep(i,x)
if (!vis[t[i]]) {
tarjan(t[i]);
low[x]=min(low[x],low[t[i]]);
} else if (in[t[i]]) low[x]=min(low[x],dfn[t[i]]);
if (low[x]==dfn[x]) {
stack[top+1]=0;++id;
for(;stack[top+1]!=x;top--) {
in[stack[top]]=0;
cl[stack[top]]=id;
}
}
}
bool check(int mid) {
int lx,rx;
fo(i,1,tot) last[i]=now[i];l=cnt;
lx=1,rx=1;
fo(i,1,n) {
while (lx<i&&a[i].x-a[lx].x>=mid) lx++;
while (rx<=n&&a[rx].x-a[i].x<mid) rx++;
link(rootx,1,n,lx,i-1,a[i].id);
link(rootx,1,n,i+1,rx-1,a[i].id);
}
// xuan x ban x
lx=1,rx=1;
fo(i,1,n) {
while (lx<=n&&b[i].y-a[lx].x>=mid) lx++;
while (rx<=n&&a[rx].x-b[i].y<mid) rx++;
link(rootx,1,n,lx,rx-1,b[i].id+n);
}
// xuan y ban x
lx=1,rx=1;
fo(i,1,n) {
while (lx<=n&&a[i].x-b[lx].y>=mid) lx++;
while (rx<=n&&b[rx].y-a[i].x<mid) rx++;
link(rooty,1,n,lx,rx-1,a[i].id);
}
// xuan x ban y
lx=1,rx=1;
fo(i,1,n) {
while (lx<i&&b[i].y-b[lx].y>=mid) lx++;
while (rx<=n&&b[rx].y-b[i].y<mid) rx++;
link(rooty,1,n,lx,i-1,b[i].id+n);
link(rooty,1,n,i+1,rx-1,b[i].id+n);
}
// xuan y ban y
tmp=top=id=0;
fo(i,1,tot) vis[i]=cl[i]=dfn[i]=low[i]=0;
fo(i,1,tot) if (!vis[i]) tarjan(i);
fo(i,1,n) if (cl[i]==cl[i+n]) return 0;
return 1;
}
void solve() {
int l=0,r=inf;
while (l<r-1) {
int mid=l+r>>1;
if (Prog2::ok(mid)) l=mid;
else r=mid;
}
// printf("%d\n",r);
l=0;
while (l<r) {
int mid=l+r>>1;
if (check(mid)) l=mid+1;
else r=mid;
}
printf("%d\n",l-1);
}
int main() {
init();
prepare();
solve();
return 0;
} | a.cc: In function 'void add(int, int)':
a.cc:25:18: error: reference to 'next' is ambiguous
25 | t[++l]=y;next[l]=last[x];last[x]=l;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
from /usr/include/c++/14/algorithm:60,
from a.cc:3:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:23:20: note: 'int next [1000005]'
23 | int last[N],now[N],next[N],t[N],l,cnt;
| ^~~~
a.cc: In function 'void tarjan(int)':
a.cc:6:40: error: reference to 'next' is ambiguous
6 | #define rep(i,a) for(int i=last[a];i;i=next[i])
| ^~~~
a.cc:91:9: note: in expansion of macro 'rep'
91 | rep(i,x)
| ^~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:23:20: note: 'int next [1000005]'
23 | int last[N],now[N],next[N],t[N],l,cnt;
| ^~~~
|
s562462137 | p03802 | C++ | #include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,b,a) for(int i=b;i>=a;i--)
#define efo(i,v,u) for(int i=last[v],u=to[last[v]];i;i=next[i],u=to[i])
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define mset(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
void read(int &n)
{
int t=0,p=1;char ch;
for(ch=getchar();!('0'<=ch && ch<='9');ch=getchar())
if(ch=='-') p=-1;
for(;'0'<=ch && ch<='9';ch=getchar()) t=t*10+ch-'0';
n=t*p;
}
const int N=4e5+5,M=50000005;
int n,nn,rtn,tot,ext,b[N][2];
struct node
{
int x,id;
}a[N];
bool cmp(node a,node b){return a.x<b.x;}
int m,co[N],to[M],next[M],last[N],list[N],L[N],R[N];
void link(int u,int v)
{
to[++m]=v,next[m]=last[u],last[u]=m;
}
bool dfs(int v)
{
if(co[v^1]) return 0;
if(co[v]) return 1;
co[v]=1;
list[++list[0]]=v;
efo(i,v,u) if(!co[u])
if(!dfs(u)) return 0;
return 1;
}
bool check(int lim)
{
m=0;mset(last,0);
fo(i,1,n)
{
link(b[i+i-1][0],b[i+i][1]),link(b[i+i][1],b[i+i-1][0]);
link(b[i+i-1][1],b[i+i][0]),link(b[i+i][0],b[i+i-1][1]);
}
fo(i,1,rtn-1) L[i]=1+rtn*(i-1),R[i]=rtn*i;
L[rtn]=1+rtn*(rtn-1),R[rtn]=nn;
fo(i,1,rtn)
fo(j,L[i],R[i]) link(tot+i,b[a[j].id][0]);
int l=1,r=1;
fo(i,1,nn)
{
while(l<nn && a[i].x-a[l].x>=lim) ++l;
while(r<nn && a[r+1].x-a[i].x<lim) ++r;
int ql=min(rtn,(l-1)/rtn+1),qr=min(rtn,(r-1)/rtn+1),qi=min(rtn,(i-1)/rtn+1);
if(ql==qr)
{
fo(j,l,r)
if(j!=i) link(b[a[i].id][1],b[a[j].id][0]);
}
else
{
if(ql==qi)
fo(j,l,i-1) link(b[a[i].id][1],b[a[j].id][0]);
else
{
fo(j,l,R[ql]) link(b[a[i].id][1],b[a[j].id][0]);
fo(j,ql+1,qi-1) link(b[a[i].id][1],tot+j);
fo(j,L[qi],i-1) link(b[a[i].id][1],b[a[j].id][0]);
}
if(qi==qr)
fo(j,i+1,r) link(b[a[i].id][1],b[a[j].id][0]);
else
{
fo(j,i+1,R[qi]) link(b[a[i].id][1],b[a[j].id][0]);
fo(j,qi+1,qr-1) link(b[a[i].id][1],tot+j);
fo(j,L[qr],r) link(b[a[i].id][1],b[a[j].id][0]);
}
}
}
mset(co,0);
fo(i,1,n)
{
int x=i+i-1,y=i+i;
if(!co[b[x][0]] && !co[b[x][1]])
{
list[0]=0;
if(!dfs(b[x][0]))
{
fo(j,1,list[0]) co[list[j]]=0;
list[0]=0;
if(!dfs(b[x][1])) return 0;
}
}
}
return 1;
}
int main()
{
int x,y;
read(n);nn=n+n;
fo(i,1,n) read(a[i+i-1].x),read(a[i+i].x);
tot=1;
fo(i,1,nn) a[i].id=i,b[i][0]=++tot,b[i][1]=++tot;
rtn=sqrt(nn);
sort(a+1,a+nn+1,cmp);
int l=0,r=a[nn].x+1;
while(l<r-1)
{
int mid=l+r>>1;
if(check(mid)) l=mid;
else r=mid;
}
printf("%d\n",l);
return 0;
} | a.cc: In function 'void link(int, int)':
a.cc:31:19: error: reference to 'next' is ambiguous
31 | to[++m]=v,next[m]=last[u],last[u]=m;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:28:19: note: 'int next [50000005]'
28 | int m,co[N],to[M],next[M],last[N],list[N],L[N],R[N];
| ^~~~
a.cc: In function 'bool dfs(int)':
a.cc:7:56: error: reference to 'next' is ambiguous
7 | #define efo(i,v,u) for(int i=last[v],u=to[last[v]];i;i=next[i],u=to[i])
| ^~~~
a.cc:39:9: note: in expansion of macro 'efo'
39 | efo(i,v,u) if(!co[u])
| ^~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:28:19: note: 'int next [50000005]'
28 | int m,co[N],to[M],next[M],last[N],list[N],L[N],R[N];
| ^~~~
|
s782622534 | p03802 | C++ | #include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,b,a) for(int i=b;i>=a;i--)
#define efo(i,v,u) for(int i=last[v],u=to[last[v]];i;i=next[i],u=to[i])
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define mset(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
void read(int &n)
{
int t=0,p=1;char ch;
for(ch=getchar();!('0'<=ch && ch<='9');ch=getchar())
if(ch=='-') p=-1;
for(;'0'<=ch && ch<='9';ch=getchar()) t=t*10+ch-'0';
n=t*p;
}
const int N=4e5+5,M=50000005;
int n,nn,rtn,tot,ext,b[N][2];
struct node
{
int x,id;
}a[N];
bool cmp(node a,node b){return a.x<b.x;}
int m,co[N],to[M],next[M],last[N],list[N],L[N],R[N];
void link(int u,int v)
{
to[++m]=v,next[m]=last[u],last[u]=m;
}
bool dfs(int v)
{
if(co[v^1]) return 0;
if(co[v]) return 1;
co[v]=1;
list[++list[0]]=v;
efo(i,v,u) if(!co[u])
if(!dfs(u)) return 0;
return 1;
}
bool check(int lim)
{
m=0;mset(last,0);
fo(i,1,n)
{
link(b[i+i-1][0],b[i+i][1]),link(b[i+i][1],b[i+i-1][0]);
link(b[i+i-1][1],b[i+i][0]),link(b[i+i][0],b[i+i-1][1]);
}
fo(i,1,rtn-1) L[i]=1+rtn*(i-1),R[i]=rtn*i;
L[rtn]=1+rtn*(rtn-1),R[rtn]=nn;
fo(i,1,rtn)
fo(j,L[i],R[i]) link(tot+i,b[a[j].id][0]);
int l=1,r=1;
fo(i,1,nn)
{
while(l<nn && a[i].x-a[l].x>=lim) ++l;
while(r<nn && a[r+1].x-a[i].x<lim) ++r;
int ql=min(rtn,(l-1)/rtn+1),qr=min(rtn,(r-1)/rtn+1),qi=min(rtn,(i-1)/rtn+1);
if(ql==qr)
{
fo(j,l,r)
if(j!=i) link(b[a[i].id][1],b[a[j].id][0]);
}
else
{
if(ql==qi)
fo(j,l,i-1) link(b[a[i].id][1],b[a[j].id][0]);
else
{
fo(j,l,R[ql]) link(b[a[i].id][1],b[a[j].id][0]);
fo(j,ql+1,qi-1) link(b[a[i].id][1],tot+j);
fo(j,L[qi],i-1) link(b[a[i].id][1],b[a[j].id][0]);
}
if(qi==qr)
fo(j,i+1,r) link(b[a[i].id][1],b[a[j].id][0]);
else
{
fo(j,i+1,R[qi]) link(b[a[i].id][1],b[a[j].id][0]);
fo(j,qi+1,qr-1) link(b[a[i].id][1],tot+j);
fo(j,L[qr],r) link(b[a[i].id][1],b[a[j].id][0]);
}
}
}
mset(co,0);
fo(i,1,n)
{
int x=i+i-1,y=i+i;
if(!co[b[x][0]] && !co[b[x][1]])
{
list[0]=0;
if(!dfs(b[x][0]))
{
fo(j,1,list[0]) co[list[j]]=0;
list[0]=0;
if(!dfs(b[x][1])) return 0;
}
}
}
return 1;
}
int main()
{
int x,y;
read(n);nn=n+n;
fo(i,1,n) read(a[i+i-1].x),read(a[i+i].x);
tot=1;
fo(i,1,nn) a[i].id=i,b[i][0]=++tot,b[i][1]=++tot;
rtn=sqrt(nn);
sort(a+1,a+nn+1,cmp);
int l=0,r=a[nn].x+1;
while(l<r-1)
{
int mid=l+r>>1;
if(check(mid)) l=mid;
else r=mid;
}
printf("%d\n",l);
return 0;
} | a.cc: In function 'void link(int, int)':
a.cc:31:19: error: reference to 'next' is ambiguous
31 | to[++m]=v,next[m]=last[u],last[u]=m;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:28:19: note: 'int next [50000005]'
28 | int m,co[N],to[M],next[M],last[N],list[N],L[N],R[N];
| ^~~~
a.cc: In function 'bool dfs(int)':
a.cc:7:56: error: reference to 'next' is ambiguous
7 | #define efo(i,v,u) for(int i=last[v],u=to[last[v]];i;i=next[i],u=to[i])
| ^~~~
a.cc:39:9: note: in expansion of macro 'efo'
39 | efo(i,v,u) if(!co[u])
| ^~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:28:19: note: 'int next [50000005]'
28 | int m,co[N],to[M],next[M],last[N],list[N],L[N],R[N];
| ^~~~
|
s384278566 | p03802 | C++ | #include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,b,a) for(int i=b;i>=a;i--)
#define efo(i,v,u) for(int i=last[v],u=to[last[v]];i;i=next[i],u=to[i])
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define mset(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
void read(int &n)
{
int t=0,p=1;char ch;
for(ch=getchar();!('0'<=ch && ch<='9');ch=getchar())
if(ch=='-') p=-1;
for(;'0'<=ch && ch<='9';ch=getchar()) t=t*10+ch-'0';
n=t*p;
}
const int N=4e5+5,M=50000005;
int n,nn,rtn,tot,ext,b[N][2];
struct node
{
int x,id;
}a[N];
bool cmp(node a,node b){return a.x<b.x;}
int m,co[N],to[M],next[M],last[N],list[N],L[N],R[N];
void link(int u,int v)
{
to[++m]=v,next[m]=last[u],last[u]=m;
}
bool dfs(int v)
{
if(co[v^1]) return 0;
if(co[v]) return 1;
co[v]=1;
list[++list[0]]=v;
efo(i,v,u) if(!co[u])
if(!dfs(u)) return 0;
return 1;
}
bool check(int lim)
{
m=0;mset(last,0);
fo(i,1,n)
{
link(b[i+i-1][0],b[i+i][1]),link(b[i+i][1],b[i+i-1][0]);
link(b[i+i-1][1],b[i+i][0]),link(b[i+i][0],b[i+i-1][1]);
}
fo(i,1,rtn-1) L[i]=1+rtn*(i-1),R[i]=rtn*i;
L[rtn]=1+rtn*(rtn-1),R[rtn]=nn;
fo(i,1,rtn)
fo(j,L[i],R[i]) link(tot+i,b[a[j].id][0]);
int l=1,r=1;
fo(i,1,nn)
{
while(l<nn && a[i].x-a[l].x>=lim) ++l;
while(r<nn && a[r+1].x-a[i].x<lim) ++r;
int ql=min(rtn,(l-1)/rtn+1),qr=min(rtn,(r-1)/rtn+1),qi=min(rtn,(i-1)/rtn+1);
if(ql==qr)
{
fo(j,l,r)
if(j!=i) link(b[a[i].id][1],b[a[j].id][0]);
}
else
{
if(ql==qi)
fo(j,l,i-1) link(b[a[i].id][1],b[a[j].id][0]);
else
{
fo(j,l,R[ql]) link(b[a[i].id][1],b[a[j].id][0]);
fo(j,ql+1,qi-1) link(b[a[i].id][1],tot+j);
fo(j,L[qi],i-1) link(b[a[i].id][1],b[a[j].id][0]);
}
if(qi==qr)
fo(j,i+1,r) link(b[a[i].id][1],b[a[j].id][0]);
else
{
fo(j,i+1,R[qi]) link(b[a[i].id][1],b[a[j].id][0]);
fo(j,qi+1,qr-1) link(b[a[i].id][1],tot+j);
fo(j,L[qr],r) link(b[a[i].id][1],b[a[j].id][0]);
}
}
}
mset(co,0);
fo(i,1,n)
{
int x=i+i-1,y=i+i;
if(!co[b[x][0]] && !co[b[x][1]])
{
list[0]=0;
if(!dfs(b[x][0]))
{
fo(j,1,list[0]) co[list[j]]=0;
list[0]=0;
if(!dfs(b[x][1])) return 0;
}
}
}
return 1;
}
int main()
{
int x,y;
read(n);nn=n+n;
fo(i,1,n) read(a[i+i-1].x),read(a[i+i].x);
tot=1;
fo(i,1,nn) a[i].id=i,b[i][0]=++tot,b[i][1]=++tot;
rtn=sqrt(nn);
sort(a+1,a+nn+1,cmp);
int l=0,r=a[nn].x+1;
while(l<r-1)
{
int mid=l+r>>1;
if(check(mid)) l=mid;
else r=mid;
}
printf("%d\n",l);
return 0;
} | a.cc: In function 'void link(int, int)':
a.cc:31:19: error: reference to 'next' is ambiguous
31 | to[++m]=v,next[m]=last[u],last[u]=m;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:28:19: note: 'int next [50000005]'
28 | int m,co[N],to[M],next[M],last[N],list[N],L[N],R[N];
| ^~~~
a.cc: In function 'bool dfs(int)':
a.cc:7:56: error: reference to 'next' is ambiguous
7 | #define efo(i,v,u) for(int i=last[v],u=to[last[v]];i;i=next[i],u=to[i])
| ^~~~
a.cc:39:9: note: in expansion of macro 'efo'
39 | efo(i,v,u) if(!co[u])
| ^~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:28:19: note: 'int next [50000005]'
28 | int m,co[N],to[M],next[M],last[N],list[N],L[N],R[N];
| ^~~~
|
s494708757 | p03802 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define rep(i,a) for(int i=last[a];i;i=next[i])
using namespace std;
int read() {
char ch;
for(ch=getchar();ch<'0'||ch>'9';ch=getchar());
int x=ch-'0';
for(ch=getchar();ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
return x;
}
const int N=1e6+5,inf=1e9;
struct pty{int x,y,id;}a[N],b[N];
bool cmpx(pty a,pty b) {return a.x<b.x;}
bool cmpy(pty a,pty b) {return a.y<b.y;}
int last[N],now[N],next[N],t[N],l,cnt;
void add(int x,int y) {
t[++l]=y;next[l]=last[x];last[x]=l;
}
int n,tot;
void init() {
n=read();tot=2*n;
fo(i,1,n) {
a[i].x=read();a[i].y=read();a[i].id=i;
b[i].x=a[i].x;b[i].y=a[i].y;b[i].id=i;
}
}
int rootx,rooty,le[N],ri[N];
void build(int &v,int l,int r,int flag) {
if (l==r) {
v=(flag==1)?(a[l].id+n):b[l].id;
return;
}
v=++tot;
int mid=l+r>>1;
build(le[v],l,mid,flag);
build(ri[v],mid+1,r,flag);
add(v,le[v]);add(v,ri[v]);
}
void link(int v,int l,int r,int x,int y,int z) {
if (x>y) return;
if (l==x&&r==y) {add(z,v);return;}
int mid=l+r>>1;
if (y<=mid) link(le[v],l,mid,x,y,z);
else if (x>mid) link(ri[v],mid+1,r,x,y,z);
else link(le[v],l,mid,x,mid,z),link(ri[v],mid+1,r,mid+1,y,z);
}
void prepare() {
sort(a+1,a+n+1,cmpx);
build(rootx,1,n,1);
sort(b+1,b+n+1,cmpy);
build(rooty,1,n,2);
fo(i,1,tot) now[i]=last[i];cnt=l;
}
int dfn[N],low[N],stack[N],cl[N],tmp,top,id;
bool vis[N],in[N];
void tarjan(int x) {
vis[x]=in[x]=1;dfn[x]=low[x]=++tmp;stack[++top]=x;
rep(i,x)
if (!vis[t[i]]) {
tarjan(t[i]);
low[x]=min(low[x],low[t[i]]);
} else if (in[t[i]]) low[x]=min(low[x],dfn[t[i]]);
if (low[x]==dfn[x]) {
stack[top+1]=0;++id;
for(;stack[top+1]!=x;top--) {
in[stack[top]]=0;
cl[stack[top]]=id;
}
}
}
bool check(int mid) {
int lx,rx;
fo(i,1,tot) last[i]=now[i];l=cnt;
lx=1,rx=1;
fo(i,1,n) {
while (lx<i&&a[i].x-a[lx].x>=mid) lx++;
while (rx<=n&&a[rx].x-a[i].x<mid) rx++;
link(rootx,1,n,lx,i-1,a[i].id);
link(rootx,1,n,i+1,rx-1,a[i].id);
}
// xuan x ban x
lx=1,rx=1;
fo(i,1,n) {
while (lx<=n&&b[i].y-a[lx].x>=mid) lx++;
while (rx<=n&&a[rx].x-b[i].y<mid) rx++;
link(rootx,1,n,lx,rx-1,b[i].id+n);
}
// xuan y ban x
lx=1,rx=1;
fo(i,1,n) {
while (lx<=n&&a[i].x-b[lx].y>=mid) lx++;
while (rx<=n&&b[rx].y-a[i].x<mid) rx++;
link(rooty,1,n,lx,rx-1,a[i].id);
}
// xuan x ban y
lx=1,rx=1;
fo(i,1,n) {
while (lx<i&&b[i].y-b[lx].y>=mid) lx++;
while (rx<=n&&b[rx].y-b[i].y<mid) rx++;
link(rooty,1,n,lx,i-1,b[i].id+n);
link(rooty,1,n,i+1,rx-1,b[i].id+n);
}
// xuan y ban y
tmp=top=id=0;
fo(i,1,tot) vis[i]=cl[i]=dfn[i]=low[i]=0;
fo(i,1,tot) if (!vis[i]) tarjan(i);
fo(i,1,n) if (cl[i]==cl[i+n]) return 0;
return 1;
}
void solve() {
int l=0,r=inf;
while (l<r) {
int mid=l+r>>1;
if (check(mid)) l=mid+1;
else r=mid;
}
printf("%d\n",l-1);
}
int main() {
init();
prepare();
solve();
return 0;
} | a.cc: In function 'void add(int, int)':
a.cc:25:18: error: reference to 'next' is ambiguous
25 | t[++l]=y;next[l]=last[x];last[x]=l;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
from /usr/include/c++/14/algorithm:60,
from a.cc:3:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:23:20: note: 'int next [1000005]'
23 | int last[N],now[N],next[N],t[N],l,cnt;
| ^~~~
a.cc: In function 'void tarjan(int)':
a.cc:6:40: error: reference to 'next' is ambiguous
6 | #define rep(i,a) for(int i=last[a];i;i=next[i])
| ^~~~
a.cc:71:9: note: in expansion of macro 'rep'
71 | rep(i,x)
| ^~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:23:20: note: 'int next [1000005]'
23 | int last[N],now[N],next[N],t[N],l,cnt;
| ^~~~
|
s972776150 | p03802 | C++ | #include<bits/stdc++.h>
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
typedef long long ll;
using namespace std;
inline int read(){
int n=0;char c;
for(c=getchar();c<'0'||c>'9';c=getchar());
for(;c>='0'&&c<='9';c=getchar())n=n*10+c-48;
return n;
}
const int maxn=2e4+5,mn=2e7+5,inf=2e7;
int i,j,n,num,ans,l,r,m,mx,x,y;
int k[maxn],next[mn],g[mn],cnt;
int dfn[maxn],low[maxn],q[maxn],cn,ct,cx,be[maxn];
bool bz[maxn];
struct ar{
int x,id;
}a[maxn];
bool cmp(ar a,ar b){
return a.x<b.x;
}
int re(int x){
return (x<=n)?x+n:x-n;
}
void add(int x,int y){
next[++cnt]=k[x],k[x]=cnt,g[cnt]=y;
}
void dfs(int x){
int i;
bz[x]=1;
dfn[x]=low[x]=++cn,q[++ct]=x;
for(i=k[x];i;i=next[i]){
int y=g[i];
if (!dfn[y]) dfs(y),low[x]=min(low[x],low[y]);else
if (bz[y]) low[x]=min(low[x],dfn[y]);
}
if(dfn[x]==low[x]){
cx++;
for(;q[ct]!=x;ct--) be[q[ct]]=cx,bz[q[ct]]=0;
be[x]=cx,bz[x]=0,ct--;
}
}
bool check(){
int i;
cn=ct=0;
memset(bz,0,sizeof(bz));
memset(dfn,0,sizeof(dfn));
fo(i,1,n<<1) if (!dfn[i]) dfs(i);
fo(i,1,n) if(be[i]==be[i+n]) return 0;
return 1;
}
int main(){
n=read();
fo(i,1,n) {
a[++num].x=read(),a[num].id=i;
a[++num].x=read(),a[num].id=i+n;
}
sort(a+1,a+1+num,cmp);
mx=a[num].x;
l=0,r=mx/(n-1);
for(;l<r;){
m=(l+r+1)>>1;
memset(k,0,sizeof(k));
cnt=0;
fo(i,1,num-1){
x=a[i].id;
fo(j,i+1,num) if (a[j].x-a[i].x<m){
y=a[j].id;
if ((x-y)%n) add(x,re(y)),add(y,re(x));
if (cnt==inf) break;
}else break;
if (cnt==inf) break;
}
if (cnt<inf&&check()) l=m;else r=m-1;
}
printf("%d\n",l);
} | a.cc: In function 'void add(int, int)':
a.cc:29:9: error: reference to 'next' is ambiguous
29 | next[++cnt]=k[x],k[x]=cnt,g[cnt]=y;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:16:13: note: 'int next [20000005]'
16 | int k[maxn],next[mn],g[mn],cnt;
| ^~~~
a.cc: In function 'void dfs(int)':
a.cc:35:24: error: reference to 'next' is ambiguous
35 | for(i=k[x];i;i=next[i]){
| ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
232 | next(_InputIterator __x, typename
| ^~~~
a.cc:16:13: note: 'int next [20000005]'
16 | int k[maxn],next[mn],g[mn],cnt;
| ^~~~
|
s073880772 | p03802 | C++ | #include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,x[N],sa[N],rank[N];
bool cmp(int a,int b){return x[a]<x[b];}
int cnt,inv[N];
vector<int> e[N];
struct segment_tree{
int id[N];
#define lc x<<1
#define rc x<<1|1
void init(int x,int l,int r,bool tp){
if (l==r) return void(id[x]=(tp?inv[l]:l));
int mid=(l+r)>>1;
init(lc,l,mid,tp);
init(rc,mid+1,r,tp);
id[x]=++cnt;
if (tp){
e[id[x]].push_back(id[lc]);
e[id[x]].push_back(id[rc]);
}
else{
e[id[lc]].push_back(id[x]);
e[id[rc]].push_back(id[x]);
}
}
void addedge(int x,int l,int r,int L,int R,int p,bool tp){
if (l>=L&&r<=R){
if (tp) e[p].push_back(id[x]);
else e[id[x]].push_back(p);
return;
}
int mid=(l+r)>>1;
if (L<=mid) addedge(lc,l,mid,L,R,p,tp);
if (R>mid) addedge(rc,mid+1,r,L,R,p,tp);
}
}T1,T2;
int dfn[N],low[N],scc[N],sta[N],top;
bool ins[N];
void tarjan(int x){
static int cnt=0;
dfn[x]=low[x]=++cnt;
ins[sta[++top]=x]=1;
for (int i=0;i<e[x].size();i++){
int v=e[x][i];
if (!dfn[v]) tarjan(v),low[x]=min(low[x],low[v]);else
if (ins[v]) low[x]=min(low[x],dfn[v]);
}
if (low[x]==dfn[x]){
while (sta[top]!=x) scc[sta[top]]=x,ins[sta[top--]]=0;
scc[x]=x;ins[x]=0;top--;
}
}
bool check(int ans){
for (int i=1;i<=cnt;i++) e[i].clear();
cnt=n+n;
T1.init(1,1,n+n,0);
T2.init(1,1,n+n,1);
for (int i=1;i<=cnt;i++) dfn[i]=0;
for (int i=1,l=1,r=1;i<=n+n;i++){
while (x[sa[l]]<=x[sa[i]]-ans) l++;
while (r<n+n&&x[sa[r+1]]<x[sa[i]]+ans) r++;
if (l<i){
T1.addedge(1,1,n+n,l,i-1,inv[i],0);
T2.addedge(1,1,n+n,l,i-1,i,1);
}
if (i<r){
T1.addedge(1,1,n+n,i+1,r,inv[i],0);
T2.addedge(1,1,n+n,i+1,r,i,1);
}
}
for (int i=1;i<=cnt;i++)
if (!dfn[i]) tarjan(i);
for (int i=1;i<=n+n;i++)
if (scc[i]==scc[inv[i]]) return 0;
return 1;
}
int main()
{
scanf("%d",&n);
for (int i=1;i<=n;i++) scanf("%d%d",&x[i],&x[i+n]);
for (int i=1;i<=n+n;i++) sa[i]=i;
sort(sa+1,sa+n+n+1,cmp);
for (int i=1;i<=n+n;i++) rank[sa[i]]=i;
for (int i=1;i<=n;i++) inv[rank[i]]=rank[i+n],inv[rank[i+n]]=rank[i];
int l=0,r=1e9;
while (l<r){
int mid=(l+r)>>1;
if (check(mid+1)) l=mid+1;else r=mid;
}
printf("%d\n",l);
return 0;
} | a.cc: In function 'int main()':
a.cc:84:34: error: reference to 'rank' is ambiguous
84 | for (int i=1;i<=n+n;i++) rank[sa[i]]=i;
| ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:4:18: note: 'int rank [100010]'
4 | int n,x[N],sa[N],rank[N];
| ^~~~
a.cc:85:36: error: reference to 'rank' is ambiguous
85 | for (int i=1;i<=n;i++) inv[rank[i]]=rank[i+n],inv[rank[i+n]]=rank[i];
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:4:18: note: 'int rank [100010]'
4 | int n,x[N],sa[N],rank[N];
| ^~~~
a.cc:85:45: error: reference to 'rank' is ambiguous
85 | for (int i=1;i<=n;i++) inv[rank[i]]=rank[i+n],inv[rank[i+n]]=rank[i];
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:4:18: note: 'int rank [100010]'
4 | int n,x[N],sa[N],rank[N];
| ^~~~
a.cc:85:59: error: reference to 'rank' is ambiguous
85 | for (int i=1;i<=n;i++) inv[rank[i]]=rank[i+n],inv[rank[i+n]]=rank[i];
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:4:18: note: 'int rank [100010]'
4 | int n,x[N],sa[N],rank[N];
| ^~~~
a.cc:85:70: error: reference to 'rank' is ambiguous
85 | for (int i=1;i<=n;i++) inv[rank[i]]=rank[i+n],inv[rank[i+n]]=rank[i];
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:4:18: note: 'int rank [100010]'
4 | int n,x[N],sa[N],rank[N];
| ^~~~
|
s487876642 | p03802 | C++ | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define an size()
using namespace std;
const ll maxn=1e4+900;
ll x[maxn][2];
set<pair<ll,ll> > st;
char viz[maxn];
ll m;
stack<ll> tagh;
bool bfs(ll a)
{
set<pair<ll,ll> > ::iterator it,itt;
it=st.lower_bound(mp(x[a][viz[a]-1]-m,0));
itt=st.lower_bound(mp(x[a][viz[a]-1]+m+1,0));
stack<ll> sttk;
ll u,j,er,ew;
pair<ll,ll> ity;
if (itt!=st.end())
{
ity=*itt;
}
else
{
ity=mp(1e10,1e10);
}
while ((*it).F<ity.F && it!=st.end() )
{
u=(*it).S;
j=(*it).F;
it++;
if (u!=a)
{
if (x[u][0]==j)
{
ew=1;
er=u;
if (viz[er]==ew)
{
return 0;
}
if (viz[er]==0)
{
viz[er]=-ew+3;
tagh.persh(er);
sttk.persh(er);
}
}
if (x[u][1]==j)
{
ew=2;
er=u;
if (viz[er]==ew)
{
return 0;
}
if (viz[er]==0)
{
viz[er]=-ew+3;
tagh.persh(er);
sttk.persh(er);
}
}
}
}
while (!sttk.empty())
{
if (bfs(sttk.top())==0)
{
return 0;
}
sttk.pop();
}
return 1;
}
int main()
{
ll n;
cin>>n;
for (ll i=0; i<n; i++)
{
cin>>x[i][0]>>x[i][1];
st.insert(mp(x[i][0],i));
st.insert(mp(x[i][1],i));
}
ll s=0;
ll t=1e9+900;
/////////////////
m=0;
for (ll i=0; i<n; i++)
{
if (viz[i]==0)
{
viz[i]=rand()%2+1;
if (!bfs(i))
{
while (!tagh.empty())
{
viz[tagh.top()]=0;
tagh.pop();
}
viz[i]=-1*viz[i]+3;
if (!bfs(i))
{
cout<<0;
return 0;
}
}
while (!tagh.empty())
{
tagh.pop();
}
}
}
/////////////
while (t-s>1)
{
m=s+t;
m/=2;
memset(viz,0,maxn);
bool ok=1;
for (ll i=n-1; i>=0; i--)
{
if (viz[i]==0)
{
viz[i]=rand()%2+1;
if (!bfs(i))
{
while (!tagh.empty())
{
viz[tagh.top()]=0;
tagh.pop();
}
viz[i]=-1*viz[i]+3;
if (!bfs(i))
{
ok=0;
break;
}
}
while (!tagh.empty())
{
tagh.pop();
}
}
}
if (ok)
{
s=m;
}
else
{
t=m;
}
}
cout<<s+1;
}
| a.cc: In function 'bool bfs(long long int)':
a.cc:52:26: error: 'class std::stack<long long int>' has no member named 'persh'
52 | tagh.persh(er);
| ^~~~~
a.cc:53:26: error: 'class std::stack<long long int>' has no member named 'persh'
53 | sttk.persh(er);
| ^~~~~
a.cc:67:26: error: 'class std::stack<long long int>' has no member named 'persh'
67 | tagh.persh(er);
| ^~~~~
a.cc:68:26: error: 'class std::stack<long long int>' has no member named 'persh'
68 | sttk.persh(er);
| ^~~~~
|
s155824996 | p03802 | C++ | hamiltonian paths are np complete so this problem is impossible | a.cc:1:1: error: 'hamiltonian' does not name a type
1 | hamiltonian paths are np complete so this problem is impossible
| ^~~~~~~~~~~
|
s802491587 | p03802 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b) ((a >> b) & 1)
#define bitset(a,b) ( a |= (1 << b))
#define bitunset(a,b) (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
std::fill((T*)array, (T*)(array + N), val);
}
pii Dir[8] = { //移動
{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};
class Graph {
public:
int vn;
int sumcost = 0;
vector<vector<pii>> g;
Graph(int n) {
vn = n;
g.resize(n);
}
virtual void con(int a, int b, int w) = 0;
int getWeight(int f, int t) {
auto itr = lower_bound(ALL(g[f]), make_pair(t, INT_MIN));
if (itr != g[f].end())
return itr->second;
return INT_MIN;
}
int Costsum() {
return sumcost;
}
};
class BiDGraph : public Graph {//無向
public:
BiDGraph(int n) : Graph(n) {}
void con(int a, int b, int w = 1) {
g[a].push_back({ b,w });
g[b].push_back({ a, w });
sumcost++;
}
};
class DGraph : public Graph {//有向
public:
DGraph(int n) : Graph(n) {}
void con(int a, int b, int w = 1) {
g[a].push_back({ b,w });
sumcost++;
}
};
void SCC(DGraph& g, vector<int>& scc) {
vector<int> orb(g.vn, -1);
scc.resize(g.vn, -1);
int cc = 0;
int k = 0;
vector<bool> used(g.vn);
stack<int> st;
function<int(int)> dfs = [&](int cur) {
int low = orb[cur] = ++k;
st.push(cur);
used[cur] = 1;
for (auto itr : g.g[cur]) {
if (orb[itr.first] == -1)
low = min(low, dfs(itr.first));
else if (used[itr.first])
low = min(low, orb[itr.first]);
}
if (low == orb[cur]) {
while (1) {
int cp = st.top(); st.pop();
used[cp] = 0;
scc[cp] = cc;
if (cp == cur)
break;
}
cc++;
}
return low;
};
REP(i, g.vn)
if (orb[i] < 0)
dfs(i);
}
bool TWO_SAT(int n, vector<pii> clause) {//否定は-, 1-indexed
DGraph g(n * 2);
for (auto itr : clause) {
int a = (itr.first < 0 ? -itr.first+n : itr.first)-1, b = (itr.second < 0 ? -itr.second+ n : itr.second)-1;
g.con(a + (a>=n?-n:n),b);
g.con(b + (b >= n ? -n : n),a);
}
vector<int> scc;
SCC(g, scc);
REP(i, n) {
if (scc[i] == scc[i + n]) {
return 0;
}
}
return 1;
}
signed main() {
int n;
scanf("%d", &n);
vector<pii> flag(n, {-1,-1});
vector<pii> ff(n*2);
REP(i, n) {
int a, b;
scanf("%d %d", &a, &b);
ff[i*2] = { a,i }; ff[i*2+1] = { b,i };
}
sort(ALL(ff));
REP(i, 2 * n) {
if(flag[ff[i].second].first!= -1)
flag[ff[i].second].second = i;
else
flag[ff[i].second].first = i;
}
int l = 0, r = ff[n*2-1].first-ff[0].second+1;
vector<pii> clause;
REP(i, n) {
clause.push_back({ 1 + flag[i].first,1 + flag[i].second });
clause.push_back({ -(1 + flag[i].first),-(1 + flag[i].second) });
}
int bm = -1;
while (1) {
int mid = (l + r) / 2;
//clause.reserve(n*n/2);
if (bm < mid) {
REP(i, n * 2) {
rep(j, max(i+1,upper_bound(ALL(ff) ,MP(ff[i].first + bm,0)) - ff.begin()), n * 2) {
if (ff[j].first - ff[i].first >= mid)
break;
if (ff[i].second != ff[j].second)
clause.push_back({ -(i + 1),-(j + 1) });
}
}
}
else {
rep(i, n*2,clause.size()) {
if (abs(ff[abs(clause[i].second)-1].first - ff[abs(clause[i].first)-1].second) >= mid) {
clause.erase(clause.begin() + i);
}
}
}
if (TWO_SAT(2 * n, clause)) {
l = mid;
}
else
r = mid;
if (r - l <= 1) {
printf("%d\n", l);
break;
}
bm = mid;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:177:43: error: no matching function for call to 'max(int, __gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >::difference_type)'
177 | rep(j, max(i+1,upper_bound(ALL(ff) ,MP(ff[i].first + bm,0)) - ff.begin()), n * 2) {
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:18:33: note: in definition of macro 'rep'
18 | #define rep(i,s,n) for(int i = (s); (n) > i; i++)
| ^
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:177:43: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__normal_iterator<std::pair<int, int>*, std::vector<std::pair<int, int> > >::difference_type' {aka 'long int'})
177 | rep(j, max(i+1,upper_bound(ALL(ff) ,MP(ff[i].first + bm,0)) - ff.begin()), n * 2) {
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:18:33: note: in definition of macro 'rep'
18 | #define rep(i,s,n) for(int i = (s); (n) > i; i++)
| ^
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:177:43: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
177 | rep(j, max(i+1,upper_bound(ALL(ff) ,MP(ff[i].first + bm,0)) - ff.begin()), n * 2) {
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:18:33: note: in definition of macro 'rep'
18 | #define rep(i,s,n) for(int i = (s); (n) > i; i++)
| ^
|
s311277306 | p03802 | C++ | #include<bits/stdc++.h>
using namespace std;
const int MAXN=2e4+5;
const int MAXM=40000010;
const int MAX=40000000;
int n;
struct node
{
int x,y;
}sv[MAXN];
struct Edge
{
int to,next;
}edge[MAXM];
int head[MAXN],tot;
void init()
{
tot=0;
memset(head,-1,sizeof(head));
}
void addedge(int u,int v)
{
edge[tot].to=v;edge[tot].next=head[u];head[u]=tot++;
}
bool vis[MAXN];//染色标记,为true表示选择
int S[MAXN],top;//栈
bool dfs(int u)
{
if(vis[u^1])return false;
if(vis[u])return true;
vis[u]=true;
S[top++]=u;
for(int i=head[u];i!=-1;i=edge[i].next)
if(!dfs(edge[i].to))
return false;
return true;
}
bool Twosat(int n)
{
memset(vis,false,sizeof(vis));
for(int i=0;i<n;i+=2)
{
if(vis[i]||vis[i^1])continue;
top=0;
if(!dfs(i))
{
while(top)vis[S[--top]]=false;
if(!dfs(i^1)) return false;
}
}
return true;
}
bool judge(int now)
{
init();
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
int u,v;
if(i==j)
{
continue;
}
if(abs(sv[i].x-sv[j].x)<now)
{
u=i*2,v=j*2;
addedge(u,v^1);
addedge(v,u^1);
}
if(abs(sv[i].x-sv[j].y)<now)
{
u=i*2,v=(j*2)^1;
addedge(u,v^1);
addedge(v,u^1);
}
if(abs(sv[i].y-sv[j].x)<now)
{
u=(i*2)^1,v=j*2;
addedge(u,v^1);
addedge(v,u^1);
}
if(abs(sv[i].y-sv[j].y)<now)
{
u=(i*2)^1,v=(j*2)^1;
addedge(u,v^1);
addedge(v,u^1);
}
if(tot>MAX)
return;
}
}
return Twosat(2*n);
}
int cnt=0;
int tmp[MAXN];
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d%d",&sv[i].x,&sv[i].y);
tmp[cnt++]=sv[i].x,tmp[cnt++]=sv[i].y;
}
sort(tmp,tmp+cnt);
int l=1,r=1e9,ans=0;
for(int i=0;i<n-1;i++)
{
r=min(r,tmp[i+n+1]-tmp[i]);
}
while(l<=r)
{
int mid=(l+r)>>1;
if(judge(mid))
{
ans=max(ans,mid);
l=mid+1;
}
else
{
r=mid-1;
}
}
printf("%d\n",ans);
return 0;
}
| a.cc: In function 'bool judge(int)':
a.cc:90:33: error: return-statement with no value, in function returning 'bool' [-fpermissive]
90 | return;
| ^~~~~~
|
s456871202 | p03802 | C++ | /*************************************************************************
> File Name: test.cpp
> Author: Akira
> Mail: qaq.febr2.qaq@gmail.com
************************************************************************/
#include<bits/stdc++.h>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
#define MST(a,b) memset(a,b,sizeof(a))
#define CLR(a) MST(a,0)
#define Sqr(a) ((a)*(a))
using namespace std;
#define MaxN 10010
#define MaxM MaxN*10
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626
const int mod = 1E9+7;
const double eps = 1e-6;
#define bug cout<<88888888<<endl;
#define debug(x) cout << #x" = " << x;
struct TwoSAT
{
int n;
vector<int> G[MaxN*2];
int S[MaxN*2],c;
bool mark[MaxN*2];
bool dfs(int x)
{
if(mark[x^1]) return false;
if(mark[x]) return true;
mark[x]=true;
S[c++]=x;
for(int i=0;i<G[x].size();i++)
if(!dfs(G[x][i])) return false;
return true;
}
void init(int n)
{
this->n=n;
for(int i=0;i<n*2;i++) G[i].clear();
memset(mark,0,sizeof(mark));
}
void add_clause(int x,int xval,int y,int yval)//这里做了修改,指x与y值有冲突
{
x=x*2+xval;
y=y*2+yval;
G[x].push_back(y^1);
G[y].push_back(x^1);
}
bool solve()
{
for(int i=0;i<2*n;i+=2)if(!mark[i] && !mark[i+1])
{
c=0;
if(!dfs(i))
{
while(c>0) mark[S[--c]]=false;
if(!dfs(i+1)) return false;
}
}
return true;
}
}TS;
int N;
pair<int, int> loc[MaxN];
bool judge(int x)
{
TS.init(N);
for(int i=0;i<N;i++)
{
for(int j=i+1;j<N;j++)
{
if( abs(loc[i].first-loc[j].first) <x ) TS.add_clause(i,0,j,0);
if( abs(loc[i].first-loc[j].second) <x ) TS.add_clause(i,0,j,1);
if( abs(loc[i].second-loc[j].first) <x ) TS.add_clause(i,1,j,0);
if( abs(loc[i].second-loc[j].second) <x ) TS.add_clause(i,1,j,1);
}
}
if(TS.solve()) return true;
else return false;
}
int main()
{
//std::ios::sync_with_stdio(false);
while(~scanf("%d", &N))
{
for(int i=0;i<N;i++) scanf("%d%d", &loc[i].first, &loc[i].second);
int l = 0, r = 1E9+7;
while(l<r)
{
int mid = ((l+r)>>1)+1;
if(judge(mid))
{
l = mid;
ans = mid;
}
else r = mid-1;
}
printf("%d\n", l);
}
//system("pause");
}
| a.cc: In function 'int main()':
a.cc:104:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
104 | ans = mid;
| ^~~
| abs
|
s581087793 | p03802 | C++ | #include<bits/stdc++.h>
using namespace std;
const int MAXN=2e4+5;
const int MAXM=400000010;
int n;
struct node
{
int x,y;
}sv[MAXN];
struct Edge
{
int to,next;
}edge[MAXM];
int head[MAXN],tot;
void init()
{
tot=0;
memset(head,-1,sizeof(head));
}
void addedge(int u,int v)
{
edge[tot].to=v;edge[tot].next=head[u];head[u]=tot++;
}
bool vis[MAXN];//染色标记,为true表示选择
int S[MAXN],top;//栈
bool dfs(int u)
{
if(vis[u^1])return false;
if(vis[u])return true;
vis[u]=true;
S[top++]=u;
for(int i=head[u];i!=-1;i=edge[i].next)
if(!dfs(edge[i].to))
return false;
return true;
}
bool Twosat(int n)
{
memset(vis,false,sizeof(vis));
for(int i=0;i<n;i+=2)
{
if(vis[i]||vis[i^1])continue;
top=0;
if(!dfs(i))
{
while(top)vis[S[--top]]=false;
if(!dfs(i^1)) return false;
}
}
return true;
}
bool judge(int now)
{
init();
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
int u,v;
if(i==j)
{
continue;
}
if(abs(sv[i].x-sv[j].x)<now)
{
u=i*2,v=j*2;
addedge(u,v^1);
addedge(v,u^1);
}
if(abs(sv[i].x-sv[j].y)<now)
{
u=i*2,v=(j*2)^1;
addedge(u,v^1);
addedge(v,u^1);
}
if(abs(sv[i].y-sv[j].x)<now)
{
u=(i*2)^1,v=j*2;
addedge(u,v^1);
addedge(v,u^1);
}
if(abs(sv[i].y-sv[j].y)<now)
{
u=(i*2)^1,v=(j*2)^1;
addedge(u,v^1);
addedge(v,u^1);
}
}
}
return Twosat(2*n);
}
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d%d",&sv[i].x,&sv[i].y);
}
int l=1,r=1e9,ans=0;
while(l<=r)
{
int mid=(l+r)>>1;
if(judge(mid))
{
ans=max(ans,mid);
l=mid+1;
}
else
{
r=mid-1;
}
}
printf("%d\n",ans);
return 0;
}
| /tmp/ccVHgc1e.o: in function `init()':
a.cc:(.text+0x6): relocation truncated to fit: R_X86_64_PC32 against symbol `tot' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/ccVHgc1e.o
/tmp/ccVHgc1e.o: in function `addedge(int, int)':
a.cc:(.text+0x36): relocation truncated to fit: R_X86_64_PC32 against symbol `tot' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `tot' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0x67): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0x85): relocation truncated to fit: R_X86_64_PC32 against symbol `tot' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0x8e): relocation truncated to fit: R_X86_64_PC32 against symbol `tot' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0xa3): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/ccVHgc1e.o
/tmp/ccVHgc1e.o: in function `dfs(int)':
a.cc:(.text+0xc3): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0xe1): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0xff): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s759595772 | p03802 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
/** Interface */
inline int readChar();
template <clas T = int> inline T readInt();
template <clas T> inline void writeInt( T x, char end = 0 );
inline void writeChar( int x );
inline void writeWord( const char *s );
/** Read */
static const int buf_size = 4096;
inline int getChar() {
static char buf[buf_size];
static int len = 0, pos = 0;
if (pos == len) {
pos = 0, len = fread(buf, 1, buf_size, stdin);
}
if (pos == len) {
return -1;
}
return buf[pos++];
}
inline int readChar() {
int c = getChar();
while (c <= 32) {
c = getChar();
}
return c;
}
template <clas T>
inline T readInt() {
int s = 1, c = readChar();
T x = 0;
if (c == '-')
s = -1, c = getChar();
while ('0' <= c && c <= '9')
x = x * 10 + c - '0', c = getChar();
return s == 1 ? x : -x;
}
/** Write */
static int write_pos = 0;
static char write_buf[buf_size];
inline void writeChar( int x ) {
if (write_pos == buf_size)
fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
write_buf[write_pos++] = x;
}
template <clas T>
inline void writeInt( T x, char end ) {
if (x < 0)
writeChar('-'), x = -x;
char s[24];
int n = 0;
while (x || !n)
s[n++] = '0' + x % 10, x /= 10;
while (n--)
writeChar(s[n]);
if (end)
writeChar(end);
}
inline void writeWord( const char *s ) { while (*s)
writeChar(*s++); }
struct Flusher {
~Flusher() {
if (write_pos)
fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
}
} flusher;
using namespace std;
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
const int MAXN = 300011;
const int INF = 1000000001;
struct segment
{
int a, b;
};
int lc[MAXN], rc[MAXN], lb[MAXN], rb[MAXN];
int tot;
vector<int> b[MAXN];
int intr[MAXN], ins[MAXN];
segment s[MAXN];
bool comp(segment a, segment b) {
return a.a < b.a;
}
int build(int l, int r) {
int t = ++ tot;
lb[t] = l; rb[t] = r;
if (l < r) {
lc[t] = build(l, (l + r) / 2);
rc[t] = build((l + r) / 2 + 1, r);
} else {
intr[s[l].b] = t;
}
return t;
}
void rmq(int t, int l, int r, int d) {
if (l > r) {
return;
}
if (l <= lb[t] && rb[t] <= r) {
b[d].push_back(t);
return;
}
if (l <= rb[lc[t]]) {
rmq(lc[t], l, r, d);
}
if (r >= lb[rc[t]]) {
rmq(rc[t], l, r, d);
}
}
int uk, used[MAXN], low[MAXN], shed[MAXN], inshed[MAXN], top, cnt;
int ini[MAXN];
void init() {
uk = 0;
for (int i = 1; i <= tot * 2; i++) {
used[i] = low[i] = shed[i] = inshed[i] = ini[i] = 0;
}
top = cnt = 0;
}
void dfs(int t) {
used[t] = low[t] = ++uk;
shed[++top] = t;
inshed[t] = 1;
for (int i = 0; i < (int)b[t].size(); i++)
if (!used[b[t][i]]) {
dfs(b[t][i]);
low[t] = min(low[b[t][i]], low[t]);
} else if (inshed[b[t][i]]) {
low[t] = min(used[b[t][i]], low[t]);
}
if (low[t] == used[t]) {
int p;
cnt++;
do {
p = shed[top--];
inshed[p] = 0;
ini[p] = cnt;
}
while (p != t);
}
}
int n;
int a[MAXN];
int main() {
n = readInt();
for (int i = 1; i <= n; i++) {
a[i] = readInt(), a[i + n] = readInt();
}
for (int i = 1; i <= n * 2; i++) {
s[i] = (segment){a[i], i};
}
sort(s + 1, s + n * 2 + 1, comp);
for (int i = 1; i <= n * 2; i++) {
ins[s[i].b] = i;
}
build(1, n * 2);
int l = 0, r = s[n * 2].a;
while (l < r) {
int mid = (l + r + 1) >> 1;
for (int i = 1; i <= tot * 2; i++) {
b[i].clear();
}
for (int i = 1; i <= tot; i++) {
if (lc[i] || rc[i]) {
b[i].push_back(lc[i]),
b[i].push_back(rc[i]);
}
}
for (int i = 1; i <= n * 2; i++) {
int r = lower_bound(s + 1, s + n * 2 + 1, (segment){a[i] + mid, 0}, comp) - s - 1,
l = upper_bound(s + 1, s + n * 2 + 1, (segment){a[i] - mid, 0}, comp) - s;
rmq(1, l, ins[i] - 1, intr[i <= n? i + n: i - n]);
rmq(1, ins[i] + 1, r, intr[i <= n? i + n: i - n]);
}
init();
for (int i = 1; i <= tot * 2; i++) {
if (!ini[i]) {
dfs(i);
}
}
bool good = 1;
for (int i = 1; i <= n; i++) {
if (ini[intr[i]] == ini[intr[i + n]]) {
good = 0;
break;
}
}
if (good) {
l = mid;
} else {
r = mid - 1;
}
}
writeInt(l, '\n');
return 0;
}
| a.cc:32:11: error: 'clas' has not been declared
32 | template <clas T = int> inline T readInt();
| ^~~~
a.cc:32:20: error: expected primary-expression before 'int'
32 | template <clas T = int> inline T readInt();
| ^~~
a.cc:32:20: error: expected '>' before 'int'
a.cc:32:32: error: 'T' does not name a type
32 | template <clas T = int> inline T readInt();
| ^
a.cc:33:11: error: 'clas' has not been declared
33 | template <clas T> inline void writeInt( T x, char end = 0 );
| ^~~~
a.cc:33:31: error: variable or field 'writeInt' declared void
33 | template <clas T> inline void writeInt( T x, char end = 0 );
| ^~~~~~~~
a.cc:33:41: error: 'T' was not declared in this scope
33 | template <clas T> inline void writeInt( T x, char end = 0 );
| ^
a.cc:33:46: error: expected primary-expression before 'char'
33 | template <clas T> inline void writeInt( T x, char end = 0 );
| ^~~~
a.cc:61:11: error: 'clas' has not been declared
61 | template <clas T>
| ^~~~
a.cc:62:8: error: 'T' does not name a type
62 | inline T readInt() {
| ^
a.cc:83:11: error: 'clas' has not been declared
83 | template <clas T>
| ^~~~
a.cc:84:13: error: variable or field 'writeInt' declared void
84 | inline void writeInt( T x, char end ) {
| ^~~~~~~~
a.cc:84:23: error: 'T' was not declared in this scope
84 | inline void writeInt( T x, char end ) {
| ^
a.cc:84:28: error: expected primary-expression before 'char'
84 | inline void writeInt( T x, char end ) {
| ^~~~
a.cc: In function 'int main()':
a.cc:209:9: error: 'readInt' was not declared in this scope
209 | n = readInt();
| ^~~~~~~
a.cc:258:5: error: 'writeInt' was not declared in this scope
258 | writeInt(l, '\n');
| ^~~~~~~~
|
s574603434 | p03802 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <casert>
#include <queue>
#include <stack>
#include <deque>
using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
/** Interface */
inline int readChar();
template <clas T = int> inline T readInt();
template <clas T> inline void writeInt( T x, char end = 0 );
inline void writeChar( int x );
inline void writeWord( const char *s );
/** Read */
static const int buf_size = 4096;
inline int getChar() {
static char buf[buf_size];
static int len = 0, pos = 0;
if (pos == len) {
pos = 0, len = fread(buf, 1, buf_size, stdin);
}
if (pos == len) {
return -1;
}
return buf[pos++];
}
inline int readChar() {
int c = getChar();
while (c <= 32) {
c = getChar();
}
return c;
}
template <clas T>
inline T readInt() {
int s = 1, c = readChar();
T x = 0;
if (c == '-')
s = -1, c = getChar();
while ('0' <= c && c <= '9')
x = x * 10 + c - '0', c = getChar();
return s == 1 ? x : -x;
}
/** Write */
static int write_pos = 0;
static char write_buf[buf_size];
inline void writeChar( int x ) {
if (write_pos == buf_size)
fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
write_buf[write_pos++] = x;
}
template <clas T>
inline void writeInt( T x, char end ) {
if (x < 0)
writeChar('-'), x = -x;
char s[24];
int n = 0;
while (x || !n)
s[n++] = '0' + x % 10, x /= 10;
while (n--)
writeChar(s[n]);
if (end)
writeChar(end);
}
inline void writeWord( const char *s ) { while (*s)
writeChar(*s++); }
struct Flusher {
~Flusher() {
if (write_pos)
fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
}
} flusher;
using namespace std;
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
const int MAXN = 300011;
const int INF = 1000000001;
struct segment
{
int a, b;
};
int lc[MAXN], rc[MAXN], lb[MAXN], rb[MAXN];
int tot;
vector<int> b[MAXN];
int intr[MAXN], ins[MAXN];
segment s[MAXN];
bool comp(segment a, segment b) {
return a.a < b.a;
}
int build(int l, int r) {
int t = ++ tot;
lb[t] = l; rb[t] = r;
if (l < r) {
lc[t] = build(l, (l + r) / 2);
rc[t] = build((l + r) / 2 + 1, r);
} else {
intr[s[l].b] = t;
}
return t;
}
void rmq(int t, int l, int r, int d) {
if (l > r) {
return;
}
if (l <= lb[t] && rb[t] <= r) {
b[d].push_back(t);
return;
}
if (l <= rb[lc[t]]) {
rmq(lc[t], l, r, d);
}
if (r >= lb[rc[t]]) {
rmq(rc[t], l, r, d);
}
}
int uk, used[MAXN], low[MAXN], shed[MAXN], inshed[MAXN], top, cnt;
int ini[MAXN];
void init() {
uk = 0;
for (int i = 1; i <= tot * 2; i++) {
used[i] = low[i] = shed[i] = inshed[i] = ini[i] = 0;
}
top = cnt = 0;
}
void dfs(int t) {
used[t] = low[t] = ++uk;
shed[++top] = t;
inshed[t] = 1;
for (int i = 0; i < (int)b[t].size(); i++)
if (!used[b[t][i]]) {
dfs(b[t][i]);
low[t] = min(low[b[t][i]], low[t]);
} else if (inshed[b[t][i]]) {
low[t] = min(used[b[t][i]], low[t]);
}
if (low[t] == used[t]) {
int p;
cnt++;
do {
p = shed[top--];
inshed[p] = 0;
ini[p] = cnt;
}
while (p != t);
}
}
int n;
int a[MAXN];
int main() {
n = readInt();
for (int i = 1; i <= n; i++) {
a[i] = readInt(), a[i + n] = readInt();
}
for (int i = 1; i <= n * 2; i++) {
s[i] = (segment){a[i], i};
}
sort(s + 1, s + n * 2 + 1, comp);
for (int i = 1; i <= n * 2; i++) {
ins[s[i].b] = i;
}
build(1, n * 2);
int l = 0, r = s[n * 2].a;
while (l < r) {
int mid = (l + r + 1) >> 1;
for (int i = 1; i <= tot * 2; i++) {
b[i].clear();
}
for (int i = 1; i <= tot; i++) {
if (lc[i] || rc[i]) {
b[i].push_back(lc[i]),
b[i].push_back(rc[i]);
}
}
for (int i = 1; i <= n * 2; i++) {
int r = lower_bound(s + 1, s + n * 2 + 1, (segment){a[i] + mid, 0}, comp) - s - 1,
l = upper_bound(s + 1, s + n * 2 + 1, (segment){a[i] - mid, 0}, comp) - s;
rmq(1, l, ins[i] - 1, intr[i <= n? i + n: i - n]);
rmq(1, ins[i] + 1, r, intr[i <= n? i + n: i - n]);
}
init();
for (int i = 1; i <= tot * 2; i++) {
if (!ini[i]) {
dfs(i);
}
}
bool good = 1;
for (int i = 1; i <= n; i++) {
if (ini[intr[i]] == ini[intr[i + n]]) {
good = 0;
break;
}
}
if (good) {
l = mid;
} else {
r = mid - 1;
}
}
writeInt(l, '\n');
return 0;
}
| a.cc:17:10: fatal error: casert: No such file or directory
17 | #include <casert>
| ^~~~~~~~
compilation terminated.
|
s321320353 | p03802 | C++ | //satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<int, ii> iii;
ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
const int N = 10002;
int n, cc, choices[N][3], seg_idx[N][3], totnodes;
int disc[16*N], low[16*N], scc_idx[16*N], sccnum, ticks;
bool instack[16*N];
stack<int> st;
iii arr[2*N];
vector<int> adj[16*N];
map<int, int> opposite;
void build(int node, int s, int e){
if(s > e) return;
totnodes = max(totnodes, node);
if(s == e){
seg_idx[arr[s].ss.ff][arr[s].ss.ss] = node;
return;
}
int mid = (s+e)/2;
build(LEFT(node), s, mid);
build(RIGHT(node), mid+1, e);
}
int get_opposite(int n){
return opposite[n];
}
void add_edge(int node, int s, int e, int lo, int hi, int idx){
if(s > e || lo > e || s > hi) return;
if(s >= lo && e <= hi){
// cout<<"found incompatibility between nodes "<<node<<" "<<idx<<endl;
// cout<<"so added edges "<<node<<" to "<<get_opposite(idx)<<" and "<<idx<<" to "<<get_opposite(node)<<endl;
adj[node].pb(get_opposite(idx));
adj[idx].pb(get_opposite(node));
return;
}
int mid = (s+e)/2;
add_edge(LEFT(node), s, mid, lo, hi, idx);
add_edge(RIGHT(node), mid+1, e, lo, hi, idx);
}
void tarjan(int v){
disc[v] = low[v] = ++ticks;
instack[v] = true;
st.push(v);
for(auto vv : adj[v])
if(disc[vv] == -1){
tarjan(vv);
low[v] = min(low[v], low[vv]);
}
else if(instack[vv]){
low[v] = min(low[v], disc[vv]);
}
if(low[v] == disc[v]){
++sccnum;
while(!st.empty() && st.top() != v){
instack[st.top()] = false;
scc_idx[st.top()] = sccnum;
st.pop();
}
instack[st.top()] = false;
scc_idx[st.top()] = sccnum;
st.pop();
}
}
bool possible(int mid){
sccnum = ticks = 0;
for(int i=1;i<=2*totnodes;i++){
adj[i].clear();
disc[i] = low[i] = scc_idx[i] = -1;
instack[i] = false;
}
while(!st.empty())
st.pop();
int lptr = 1, rptr = 1;
for(int i=1;i<=2*n;i++){
while(lptr < i && arr[lptr].ff <= arr[i].ff-mid)
lptr++;
while(rptr+1 <= 2*n && arr[rptr+1].ff < arr[i].ff+mid)
rptr++;
// cout<<"at i = "<<i<<": "<<lptr<<" "<<rptr<<endl;
if(lptr <= i-1)
add_edge(1, 1, 2*n, lptr, i-1, seg_idx[arr[i].ss.ff][arr[i].ss.ss]);
if(rptr >= i+1)
add_edge(1, 1, 2*n, i+1, rptr, seg_idx[arr[i].ss.ff][arr[i].ss.ss]);
}
for(int i=1;i<=2*n;i++){
int node = seg_idx[arr[i].ss.ff][arr[i].ss.ss], temp = node;
node /= 2;
while(node >= 1){
adj[temp].pb(node);
// cout<<"yolo added edges "<<node<<" to "<<temp<<" and "<<temp<<" to "<<node<<endl;
node /= 2;
}
}
// cout<<"extra edges"<<endl;
// for(int i=1;i<=n;i++){
// cout<<"found incompatibilty between nodes "<<seg_idx[i][1]<<" "<<seg_idx[i][2]<<endl;
// // adj[seg_idx[i][1]].pb(totnodes + seg_idx[i][2]);
// // adj[seg_idx[i][2]].pb(totnodes + seg_idx[i][1]);
// // adj[totnodes + seg_idx[i][1]].pb(seg_idx[i][2]);
// // adj[totnodes + seg_idx[i][2]].pb(seg_idx[i][1]);
// }
// cout<<16*N<<" "<<totnodes<<" "<<2*totnodes<<endl;
ticks = 0;
for(int i=1;i<=2*totnodes;i++)
if(disc[i] == -1)
tarjan(i);
// cout<<ticks<<" "<<totnodes<<endl;;
// for(int i=1;i<=ticks;i++) cout<<scc_idx[i]<<" ";cout<<endl;
for(int i=1;i<=2*n;i++){
int node = seg_idx[arr[i].ss.ff][arr[i].ss.ss];
if(scc_idx[node] == scc_idx[get_opposite(node)]){
// cout<<"shit occurred at "<<node<<endl;
return false;
}
}
return true;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
struct rlimit rl;
int result = getrlimit(RLIMIT_STACK, &rl);
rl.rlim_cur = 32 * 1024 * 1024;
result = setrlimit(RLIMIT_STACK, &rl);
cin>>n;
for(int i=1;i<=n;i++){
cin>>choices[i][1]>>choices[i][2];
arr[2*i-1] = {choices[i][1], {i, 1}};
arr[2*i] = {choices[i][2], {i, 2}};
}
sort(arr+1, arr+2*n+1);
build(1, 1, 2*n);
for(int i=1;i<=totnodes;i++){
opposite[i] = totnodes+i;
opposite[totnodes+i] = i;
}
for(int i=1;i<=n;i++){
opposite[seg_idx[i][1]] = seg_idx[i][2];
opposite[seg_idx[i][2]] = seg_idx[i][1];
}
// cout<<totnodes<<" "<<8*N<<endl;
// cout<<"opposite:\n";
// for(int i=1;i<=totnodes;i++) cout<<opposite[i]<<":"<<opposite[opposite[i]]<<" ";cout<<endl;
// cout<<"seg_idx: ";for(int i=1;i<=n;i++) cout<<seg_idx[i][1]<<":"<<seg_idx[i][2]<<" ";cout<<endl;
// cout<<"arr: ";for(int i=1;i<=2*n;i++) cout<<arr[i].ff<<":"<<arr[i].ss.ff<<":"<<arr[i].ss.ss<<" ";cout<<endl;
// cout<<totnodes<<endl;
// cout<<possible(1e9)<<endl;;
int ans = 0, lo = 1, hi = (int)1e9;
while(lo <= hi){
int mid = (lo + hi)/2;
if(possible(mid)){
ans = max(ans, mid);
lo = mid+1;
}
else{
hi = mid-1;
}
}
cout<<ans;
return 0;
}
| a.cc: In function 'int main()':
a.cc:172:19: error: aggregate 'main()::rlimit rl' has incomplete type and cannot be defined
172 | struct rlimit rl;
| ^~
a.cc:173:28: error: 'RLIMIT_STACK' was not declared in this scope
173 | int result = getrlimit(RLIMIT_STACK, &rl);
| ^~~~~~~~~~~~
a.cc:173:18: error: 'getrlimit' was not declared in this scope; did you mean 'rlimit'?
173 | int result = getrlimit(RLIMIT_STACK, &rl);
| ^~~~~~~~~
| rlimit
a.cc:175:14: error: 'setrlimit' was not declared in this scope; did you mean 'rlimit'?
175 | result = setrlimit(RLIMIT_STACK, &rl);
| ^~~~~~~~~
| rlimit
|
s723242151 | p03802 | C++ | #include <bits/stdc++.h>
#define N 30010
using namespace std;
typedef long long ll;
inline ll read()
{
ll x=0,f=1; char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
return x*f;
}
struct edge
{
int u,v,next;
}vs[N*30*2];
int n,st[N*7],ee,las,id[N],nd[N*7],idx[N];
ll X[N],Y[N],V[N];
int dfn[N*7],low[N*7],tim,vis[N*7],op[N],tot,bl[N*7];
stack <int> St;
inline void addedge(int u,int v)
{
vs[++ee].v=v;vs[ee].next=st[u];st[u]=ee;
}
inline bool cmp(const int a,const int b)
{
return V[a]<V[b];
}
void built(int l,int r,int rt)
{
nd[rt]=++las;
if(l==r)
{
addedge(nd[rt],op[l]);
return ;
}
int mid=(l+r)>>1;
built(l,mid,rt<<1);
built(mid+1,r,rt<<1|1);
addedge(nd[rt],nd[rt<<1]);
addedge(nd[rt],nd[rt<<1|1]);
}
void linkedge(int L,int R,int x,int l,int r,int rt)
{
if(L<=l&&r<=R)
{
addedge(x,nd[rt]);
return ;
}
int mid=(l+r)>>1;
if(mid>=L) linkedge(L,R,x,l,mid,rt<<1);
if(mid<R) linkedge(L,R,x,mid+1,r,rt<<1|1);
}
void dfs(int rt)
{
vis[rt]=1; dfn[rt]=low[rt]=++tim;
St.push(rt);
for(int i=st[rt];i;i=vs[i].next)
{
if(vis[vs[i].v])
{
low[rt]=min(low[rt],dfn[vs[i].v]);
}
else if(!dfn[vs[i].v])
{
dfs(vs[i].v);
low[rt]=min(low[rt],low[vs[i].v]);
}
}
if(low[rt]==dfn[rt])
{
++tot;
while(St.top()!=rt)
{
bl[St.top()]=tot;
vis[St.top()]=0;
St.pop();
}
St.pop(); bl[rt]=tot; vis[rt]=0;
}
}
bool check(ll x)
{
memset(st,0,sizeof st);
ee=0; las=n+n; tim=0;
built(1,n+n,1);
for(int i=1;i<=n+n;i++)
{
int pr=upper_bound(V+1,V+1+n+n,V[i]-x)-V;
int nx=lower_bound(V+1,V+1+n+n,V[i]+x)-V-1;
if(pr<i) linkedge(pr,i-1,i,1,n+n,1);
if(nx>i) linkedge(i+1,nx,i,1,n+n,1);
}
for(int i=1;i<=las;i++) vis[i]=dfn[i]=low[i]=0;
for(int i=1;i<=las;i++) if(!dfn[i]) dfs(i);
for(int i=1;i<=n+n;i++) if(bl[i]==bl[op[i]]) return 0;
return 1;
}
int main()
{
//freopen("read.in","r",stdin);
n=read();
for(int i=1;i<=n;i++)
X[i]=read(),Y[i]=read(),
V[++V[0]]=X[i],id[V[0]]=V[0],
V[++V[0]]=Y[i],id[V[0]]=V[0];
sort(id+1,id+1+n+n,cmp);
for(int i=1;i<=n+n;i++) idx[id[i]]=i;
for(int i=1;i<=n+n;i++) op[i]=idx[(id[i]&1)? id[i]+1: id[i]-1];
sort(V+1,V+1+n+n);
ll l=0,r=1000000000,ans;
while(l<=r)
{
int mid=(l+r)>>1;
if(check(mid)) ans=mid,l=mid+1;
else r=mid-1;
}
printf("%lld\n",ans);
} | a.cc: In function 'bool check(ll)':
a.cc:95:54: error: unable to find numeric literal operator 'operator""\U0000ff1b'
95 | for(int i=1;i<=las;i++) vis[i]=dfn[i]=low[i]=0;
| ^~~
a.cc:96:21: error: 'i' was not declared in this scope
96 | for(int i=1;i<=las;i++) if(!dfn[i]) dfs(i);
| ^
|
s315872871 | p03802 | C++ | #include <bits/stdc++.h>
#define N 30010
using namespace std;
typedef long long ll;
inline ll read()
{
ll x=0,f=1; char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
return x*f;
}
struct edge
{
int u,v,next;
}vs[N*30*2];
int n,st[N*7],ee,las,id[N],nd[N*7],idx[N];
ll X[N],Y[N],V[N];
int dfn[N*7],low[N*7],tim,vis[N*7],op[N],tot,bl[N*7];
stack <int> St;
inline void addedge(int u,int v)
{
vs[++ee].v=v;vs[ee].next=st[u];st[u]=ee;
}
inline bool cmp(const int a,const int b)
{
return V[a]<V[b];
}
void built(int l,int r,int rt)
{
nd[rt]=++las;
if(l==r)
{
addedge(nd[rt],op[l]);
return ;
}
int mid=(l+r)>>1;
built(l,mid,rt<<1);
built(mid+1,r,rt<<1|1);
addedge(nd[rt],nd[rt<<1]);
addedge(nd[rt],nd[rt<<1|1]);
}
void linkedge(int L,int R,int x,int l,int r,int rt)
{
if(L<=l&&r<=R)
{
addedge(x,nd[rt]);
return ;
}
int mid=(l+r)>>1;
if(mid>=L) linkedge(L,R,x,l,mid,rt<<1);
if(mid<R) linkedge(L,R,x,mid+1,r,rt<<1|1);
}
void dfs(int rt)
{
vis[rt]=1; dfn[rt]=low[rt]=++tim;
St.push(rt);
for(int i=st[rt];i;i=vs[i].next)
{
if(vis[vs[i].v])
{
low[rt]=min(low[rt],dfn[vs[i].v]);
}
else if(!dfn[vs[i].v])
{
dfs(vs[i].v);
low[rt]=min(low[rt],low[vs[i].v]);
}
}
if(low[rt]==dfn[rt])
{
++tot;
while(St.top()!=rt)
{
bl[St.top()]=tot;
vis[St.top()]=0;
St.pop();
}
St.pop(); bl[rt]=tot; vis[rt]=0;
}
}
bool check(ll x)
{
memset(st,0,sizeof st);
ee=0; las=n+n; tim=0;
built(1,n+n,1);
for(int i=1;i<=n+n;i++)
{
int pr=upper_bound(V+1,V+1+n+n,V[i]-x)-V;
int nx=lower_bound(V+1,V+1+n+n,V[i]+x)-V-1;
if(pr<i) linkedge(pr,i-1,i,1,n+n,1);
if(nx>i) linkedge(i+1,nx,i,1,n+n,1);
}
for(int i=1;i<=las;i++) vis[i]=dfn[i]=low[i]=0
for(int i=1;i<=las;i++) if(!dfn[i]) dfs(i);
for(int i=1;i<=n+n;i++) if(bl[i]==bl[op[i]]) return 0;
return 1;
}
int main()
{
//freopen("read.in","r",stdin);
n=read();
for(int i=1;i<=n;i++)
X[i]=read(),Y[i]=read(),
V[++V[0]]=X[i],id[V[0]]=V[0],
V[++V[0]]=Y[i],id[V[0]]=V[0];
sort(id+1,id+1+n+n,cmp);
for(int i=1;i<=n+n;i++) idx[id[i]]=i;
for(int i=1;i<=n+n;i++) op[i]=idx[(id[i]&1)? id[i]+1: id[i]-1];
sort(V+1,V+1+n+n);
ll l=0,r=1000000000,ans;
while(l<=r)
{
int mid=(l+r)>>1;
if(check(mid)) ans=mid,l=mid+1;
else r=mid-1;
}
printf("%lld\n",ans);
} | a.cc: In function 'bool check(ll)':
a.cc:95:55: error: expected ';' before 'for'
95 | for(int i=1;i<=las;i++) vis[i]=dfn[i]=low[i]=0
| ^
| ;
96 | for(int i=1;i<=las;i++) if(!dfn[i]) dfs(i);
| ~~~
a.cc:96:21: error: 'i' was not declared in this scope
96 | for(int i=1;i<=las;i++) if(!dfn[i]) dfs(i);
| ^
|
s489748858 | p03802 | C++ | #include <cstdio>
#include <iostream>
#include <queue>
#include <algorithm>
#include <cstring>
#define X first
#define Y second
#define MK std::make_pair
typedef std::pair<int, int> pii;
template <typename T> inline bool chkmax(T &x, T y) {
return x<y? x=y, true : false;
}
template <typename T> inline bool chkmin(T &x, T y) {
return y<x? x=y, true : false;
}
enum {
MAXN = 100000 + 5,
MAXM = 2000000 + 5
};
#define MID ((l+r)>>1)
struct edge {
int u, v, next;
edge() {
}
edge(int _u, int _v, int _next):
u(_u), v(_v), next(_next) {}
};
int tote, totn;
int head[MAXN];
edge E[MAXM];
namespace SCC {
int totscc;
int sccid[MAXN];
int dfn[MAXN];
int low[MAXN];
int top;
int st[MAXN];
int dfc;
void dfs(int u) {
int e, v;
dfn[u] = low[u] = dfc++;
st[top++] = u;
for (e=head[u]; ~e; e=E[e].next) {
v = E[e].v;
if (!~dfn[v]) {
dfs(v);
chkmin(low[u], low[v]);
} else if (!~sccid[v])
chkmin(low[u], dfn[v]);
}
if (low[u] == dfn[u]) {
while (true) {
sccid[st[top-1]] = totscc;
--top;
if (st[top] == u)
break;
}
++ totscc;
}
}
void exec() {
int i;
totscc = dfc = 0;
memset(sccid, -1, sizeof sccid);
memset(dfn, -1, sizeof dfn);
for (i=0; i<MAXN; ++i)
if (!~dfn[i])
dfs(i);
}
}
int n;
int tot;
pii a[MAXN], in[MAXN];
int c[MAXN];
int id[MAXN][2];
int ontree[MAXN];
void addedge(int u, int v) {
E[tote] = edge(u, v, head[u]), head[u] = tote++;
}
void build(int o, int l, int r) {
chkmax(totn, o+1);
if (o > 1)
addedge(o>>1, o);
if (r-l > 1) {
build(o<<1, l, MID);
build(o<<1|1, MID, r);
} else
ontree[l] = o;
}
void addedge(int o, int l, int r, int ql, int qr, int u) {
if (l >= r) return ;
if (ql >= qr) return ;
if (ql <= l && r <= qr)
addedge(u, o);
else {
if (ql < MID) addedge(o<<1, l, MID, ql, qr, u);
if (MID < qr) addedge(o<<1|1, MID, r, ql, qr, u);
}
}
bool check(int d) {
int u, l, r;
tote = totn = 0;
memset(head, -1, sizeof head);
build(1, 0, tot);
for (u=0; u<n; ++u) {
addedge(ontree[id[u][0]], totn + id[u][1]);
addedge(ontree[id[u][1]], totn + id[u][0]);
addedge(totn + id[u][1], ontree[id[u][0]]);
addedge(totn + id[u][0], ontree[id[u][1]]);
l = std::upper_bound(c, c+tot, in[u].X - d) - c;
r = std::upper_bound(c, c+tot, in[u].X+d-1) - c;
addedge(1, 0, tot, l, id[u][0], totn + id[u][0]);
addedge(1, 0, tot, id[u][0]+1, r, totn + id[u][0]);
l = std::upper_bound(c, c+tot, in[u].Y - d) - c;
r = std::upper_bound(c, c+tot, in[u].Y+d-1) - c;
addedge(1, 0, tot, l, id[u][1], totn + id[u][1]);
addedge(1, 0, tot, id[u][1]+1, r, totn + id[u][1]);
}
assert(tote < MAXM);
SCC::exec();
for (u=0; u<n; ++u)
if (SCC::sccid[totn + id[u][0]] == SCC::sccid[totn + id[u][1]])
return false;
return true;
}
void exec() {
pii info;
int i, x, y, l, r;
scanf("%d", &n);
tot = 0;
for (i=0; i<n; ++i) {
scanf("%d%d", &x, &y);
a[tot++] = std::make_pair(x, i);
a[tot++] = std::make_pair(y, i);
in[i] = std::make_pair(x, y);
}
std::sort(a, a+tot);
for (i=0; i<tot; ++i) c[i] = a[i].X;
for (i=0; i<n; ++i) {
id[i][0] = std::lower_bound(a, a+tot, MK(in[i].X, i)) - a;
id[i][1] = std::lower_bound(a, a+tot, MK(in[i].Y, i)) - a;
}
l = 0, r = 1e9 + 1;
while (l+1 < r)
(check(MID)? l : r) = MID;
printf("%d\n", l);
}
int main() {
if (fopen("F.in", "r") != NULL) {
freopen("F.in", "r", stdin);
freopen("F.out", "w", stdout);
}
exec();
return 0;
}
| a.cc: In function 'bool check(int)':
a.cc:146:3: error: 'assert' was not declared in this scope
146 | assert(tote < MAXM);
| ^~~~~~
a.cc:6:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
5 | #include <cstring>
+++ |+#include <cassert>
6 |
|
s364080237 | p03802 | C++ | #include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
int N, X[20000], Y[20000];
bitset< 20000 > graph[20000];
bool used[20000];
int cmp[20000];
int order[20000];
int ptr;
void dfs(int idx)
{
if(used[idx]++) return;
for(int i = 0; i < N * 2; i++) if(graph[idx][i]) dfs(i);
order[ptr++] = idx;
}
void rdfs(int idx, const int cnt)
{
if(~cmp[idx]) return;
cmp[idx] = cnt;
for(int i = 0; i < N * 2; i++) if(graph[i][idx]) rdfs(i, cnt);
}
bool cross(int s, int t, int g)
{
if(s > t) swap(t, s);
return (t - s < g);
}
bool check(int v)
{
for(int i = 0; i < 2 * N; i++) graph[i].reset();
for(int i = 0; i < N; i++) {
for(int j = i + 1; j < N; j++) {
if(cross(X[i], X[j], v)) {
graph[i << 1][(j << 1) | 1] = true;
graph[j << 1][(i << 1) | 1] = true;
}
if(cross(X[i], Y[j], v)) {
graph[i << 1][j << 1] = true;
graph[(j << 1) | 1][(i << 1) | 1] = true;
}
if(cross(Y[i], X[j], v)) {
graph[(i << 1) | 1][(j << 1) | 1] = true;
graph[j << 1][i << 1] = true;
}
if(cross(Y[i], Y[j], v)) {
graph[(i << 1) | 1][j << 1] = true;
graph[(j << 1) | 1][i << 1] = true;
}
}
}
memset(used, false, sizeof(used));
memset(cmp, -1, sizeof(cmp));
ptr = 0;
for(int i = 0; i < 2 * N; i++) dfs(i);
for(int i = ptr - 1; i >= 0; i--) rdfs(order[i], i);
for(int i = 0; i < 2 * N; i += 2) if(cmp[i] == cmp[i + 1]) return (false);
return (true);
}
int main()
{
scanf("%d", &N);
for(int i = 0; i < N; i++) {
scanf("%d %d", &X[i], &Y[i]);
}
int ret = INF;
for(int i = 0; i < N; i++) {
for(int j = i + 1; j < N; j++) {
int st = max({X[i] - X[j], X[i] - Y[j], Y[i] - X[j], Y[i] - Y[j]});
st = max({st, X[j] - X[i], X[j] - Y[i], Y[j] - X[i], Y[j] - Y[i]});
ret = min(ret, st);
}
}
int low = 0, high = ret;
while(high - low > 0) {
int mid = (low + high + 1) >> 1;
if(check(mid)) low = mid;
else high = mid - 1;
}
cout << low << endl;
} | a.cc: In function 'void dfs(int)':
a.cc:17:14: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
17 | if(used[idx]++) return;
| ~~~~~~~~^
|
s493724399 | p03802 | C++ | #include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#define SIZE 20005
#define BT 1024*32*2
#define MX 1000005
#define INF 1000000005
using namespace std;
int sz;
vector <int> vec[MX];
vector <int> rvec[MX];
struct segtree
{
int seg[BT];
int mum;
void init(int n)
{
mum=1;
while(mum<n) mum<<=1;
for(int i=0;i<mum*2;i++)
{
vec[sz].clear();
seg[i]=sz++;
}
for(int i=0;i<mum-1;i++)
{
vec[seg[i]].push_back(seg[i*2+1]);
vec[seg[i]].push_back(seg[i*2+2]);
}
}
void add(int k,int x)
{
k+=mum-1;
nw(k);
vec[seg[k]].push_back(x);
}
void nw(int k)
{
vec[sz].clear();
vec[sz].push_back(seg[k]);
seg[k]=sz++;
if(k>0)
{
nw((k-1)/2);
vec[seg[(k-1)/2]].push_back(seg[k]);
}
}
void update(int a,int b,int k,int l,int r,int v)
{
if(b<=l||r<=a) return;
if(a<=l&&r<=b) vec[v].push_back(seg[k]);
else
{
update(a,b,k*2+1,l,(l+r)/2,v);
update(a,b,k*2+2,(l+r)/2,r,v);
}
}
void update(int a,int b,int v)
{
update(a,b,0,0,mum,v);
}
};
segtree seg;
int X[SIZE],Y[SIZE];
vector <int> vx;
vector <int> vs;
bool use[MX];
int cmb[MX];
int n;
void dfs(int v)
{
use[v]=true;
for(int i=0;i<vec[v].size();i++) if(!use[vec[v][i]]) dfs(vec[v][i]);
vs.push_back(v);
}
void rdfs(int v,int k)
{
cmb[v]=k;
use[v]=true;
for(int i=0;i<rvec[v].size();i++) if(!use[rvec[v][i]]) rdfs(rvec[v][i],k);
}
void scc()
{
vs.clear();
memset(use,false,sizeof(use));
for(int i=0;i<sz;i++) if(!use[i]) dfs(i);
memset(use,false,sizeof(use));
int k=0;
for(int i=sz-1;i>=0;i--) if(!use[vs[i]]) rdfs(vs[i],k++);
}
bool solve(int d)
{
for(int i=0;i<2*n;i++) vec[i].clear();
sz=2*n;
seg.init(vx.size()+2);
for(int i=0;i<n;i++)
{
//i*2 : Xを使うとき
//i*2+1 : Yを使うとき
int L=lower_bound(vx.begin(),vx.end(),vx[X[i]]-d+1)-vx.begin(),R=upper_bound(vx.begin(),vx.end(),vx[X[i]]+d-1)-vx.begin()-1;
if(L<=R) seg.update(L,R+1,i*2);
L=lower_bound(vx.begin(),vx.end(),vx[Y[i]]-d+1)-vx.begin(),R=upper_bound(vx.begin(),vx.end(),vx[Y[i]]+d-1)-vx.begin()-1;
if(L<=R) seg.update(L,R+1,i*2+1);
seg.add(X[i],i*2+1);
seg.add(Y[i],i*2);
}
seg.init(vx.size()+2);
for(int i=n-1;i>=0;i--)
{
int L=lower_bound(vx.begin(),vx.end(),vx[X[i]]-d+1)-vx.begin(),R=upper_bound(vx.begin(),vx.end(),vx[X[i]]+d-1)-vx.begin()-1;
if(L<=R) seg.update(L,R+1,i*2);
L=lower_bound(vx.begin(),vx.end(),vx[Y[i]]-d+1)-vx.begin(),R=upper_bound(vx.begin(),vx.end(),vx[Y[i]]+d-1)-vx.begin()-1;
if(L<=R) seg.update(L,R+1,i*2+1);
seg.add(X[i],i*2+1);
seg.add(Y[i],i*2);
}
for(int i=0;i<sz;i++) rvec[i].clear();
for(int i=0;i<sz;i++)
{
for(int j=0;j<vec[i].size();j++)
{
int to=vec[i][j];
rvec[to].push_back(i);
}
}
scc();
//for(int i=0;i<n;i++) printf("%d %d\n",cmb[i*2],cmb[i*2+1]);
for(int i=0;i<n;i++)
{
if(cmb[i*2]==cmb[i*2+1]) return false;
}
return true;
}
int main()
{
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d %d",&X[i],&Y[i]);
vx.push_back(X[i]);
vx.push_back(Y[i]);
}
sort(vx.begin(),vx.end());
vx.erase(unique(vx.begin(),vx.end()),vx.end());
for(int i=0;i<n;i++)
{
X[i]=lower_bound(vx.begin(),vx.end(),X[i])-vx.begin();
Y[i]=lower_bound(vx.begin(),vx.end(),Y[i])-vx.begin();
}
//if(solve(2)) puts("YES");
//return 0;
int l=-1,r=min(INF/(n-1))+1;
while(r-l>1)
{
int m=(l+r)/2;
if(solve(m)) l=m;
else r=m;
//printf("%d %d\n",l,r);
}
printf("%d\n",l);
return 0;
}
| a.cc: In function 'int main()':
a.cc:158:23: error: no matching function for call to 'min(int)'
158 | int l=-1,r=min(INF/(n-1))+1;
| ~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from a.cc:3:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed:
a.cc:158:23: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
158 | int l=-1,r=min(INF/(n-1))+1;
| ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided
|
s935746531 | p03802 | C++ | #include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;
const int MAXN = 20001;
int dn;
vector<int> graph[MAXN];
int up[MAXN], visit[MAXN], vtime;
vector<int> stk;
int scc_idx[MAXN], scc_cnt;
void dfs(int nod) {
up[nod] = visit[nod] = ++vtime;
stk.push_back(nod);
for (int next : graph[nod]) {
if (visit[next] == 0) {
dfs(next);
up[nod] = min(up[nod], up[next]);
}
else if (scc_idx[next] == 0)
up[nod] = min(up[nod], visit[next]);
}
if (up[nod] == visit[nod]) {
++scc_cnt;
int t;
do {
t = stk.back();
stk.pop_back();
scc_idx[t] = scc_cnt;
} while (!stk.empty() && t != nod);
}
}
// find SCCs in given directed graph
// O(V+E)
void get_scc() {
vtime = 0;
memset(visit, 0, sizeof(visit));
scc_cnt = 0;
memset(scc_idx, 0, sizeof(scc_idx));
for (int i = 0; i < dn; ++i)
if (visit[i] == 0) dfs(i);
}
int n;
int coord[10000][2];
bool chk(int lowerlimit) {
for (int i = 0; i < n * 2; ++i) {
graph[i].clear();
}
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
for (int a = 0; a < 2; ++a) {
for (int b = 0; b < 2; ++b) {
if (abs(coord[i][a] - coord[j][b]) < lowerlimit) {
int nodei = i * 2 + a, nodej = j * 2 + b;
//// nodei -> !nodej , nodej -> !nodei
graph[nodei].push_back(nodej ^ 1);
graph[nodej].push_back(nodei ^ 1);
}
}
}
}
}
dn = n * 2;
get_scc();
for (int i = 0; i < n; ++i) {
if (scc_idx[i * 2] == scc_idx[i * 2 + 1]) {
return false;
}
}
return true;
}
void proc() {
scanf("%d", &n);
for (int i = 0; i < n; ++i) {
scanf("%d %d", &coord[i][0], &coord[i][1]);
}
int left = 0, right = 100;
while (left <= right) {
int mid = ((long long)left + right) / 2;
if (chk(mid)) {
left = mid + 1;
}
else {
right = mid - 1;
}
}
printf("%d", right);
}
int main() {
//freopen("input.txt", "r", stdin);
proc();
return 0;
} | a.cc: In function 'void get_scc()':
a.cc:39:9: error: 'memset' was not declared in this scope
39 | memset(visit, 0, sizeof(visit));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <algorithm>
+++ |+#include <cstring>
5 | using namespace std;
|
s533934273 | p03803 | C++ | #include <iostream.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
int flag = 0;
if(a == 1 && b !=1){
cout<<"Alice"<<endl;
flag = 1;
}else if(b == 1 && a !=1){
cout<<"Bob"<<endl;
flag = 1;
}else if(a==1 && b==1){
cout<<"Draw"<<endl;
flag = 1;
}
if(flag == 0){
if(a > b){
cout<<"Alice"<<endl;
}else if(b > a){
cout<<"Bob"<<endl;
}else{
cout<<"Draw"<<endl;
}
}
}
| a.cc:1:10: fatal error: iostream.h: No such file or directory
1 | #include <iostream.h>
| ^~~~~~~~~~~~
compilation terminated.
|
s522279611 | p03803 | C++ | #include<iostream>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
if(a = b){
cout << "Draw";
}
else if(a != 1 && b != 1){
if(a > b){
cout << "Alice";
}
else{
cout << "Bob";
}
}
else if(a = 1||b = 1){
if(a = 1){
cout << "Alice";
}
else if(b = 1){
cout << "Bob";
}
}
} | a.cc: In function 'int main()':
a.cc:18:16: error: lvalue required as left operand of assignment
18 | else if(a = 1||b = 1){
| ~^~~
|
s023536725 | p03803 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)
using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;
int main() {
int a,b;
cin >> a >> b;
if(a>b&&b!=!) cout << "Alice" << endl;
else if(a==b) cout << "Draw" << endl;
else cout << "Bob" << endl;
}
| a.cc: In function 'int main()':
a.cc:17:15: error: expected primary-expression before ')' token
17 | if(a>b&&b!=!) cout << "Alice" << endl;
| ^
|
s093003891 | p03803 | C++ | #include<iostream>
using namespace std;
int sum(int a,int b){
if(a==b)
return "Draw";
else if(a!=1||b!=1){
if(a>b)
return "Alice";
else
return "Bob";
}
else{
if(a==1)
return "Alice";
else
return "Bob";
}
}
int main(){
int a,b;
cin>>a>>b;
cout<<sum(a,b);
return 0;
}
| a.cc: In function 'int sum(int, int)':
a.cc:5:12: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
5 | return "Draw";
| ^~~~~~
| |
| const char*
a.cc:8:14: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
8 | return "Alice";
| ^~~~~~~
| |
| const char*
a.cc:10:14: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
10 | return "Bob";
| ^~~~~
| |
| const char*
a.cc:14:14: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
14 | return "Alice";
| ^~~~~~~
| |
| const char*
a.cc:16:12: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
16 | return "Bob";
| ^~~~~
| |
| const char*
|
s913945388 | p03803 | C++ | #include<iostream>
#include<string>
using namespace std;
int sum(int a,int b){
if(a==b)
return g;
else if(a!=1||b!=1){
if(a>b)
return h;
else
return t;
}
else{
if(a==1)
return h;
else
return t;
}
}
int main(){
int a,b;
string g='Alice',h='Bob',t='Draw';
cin>>a>>b;
cout<<sum(a,b);
return 0;
}
| a.cc:23:12: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
23 | string g='Alice',h='Bob',t='Draw';
| ^~~~~~~
a.cc:23:22: warning: multi-character character constant [-Wmultichar]
23 | string g='Alice',h='Bob',t='Draw';
| ^~~~~
a.cc:23:30: warning: multi-character character constant [-Wmultichar]
23 | string g='Alice',h='Bob',t='Draw';
| ^~~~~~
a.cc: In function 'int sum(int, int)':
a.cc:7:12: error: 'g' was not declared in this scope
7 | return g;
| ^
a.cc:10:14: error: 'h' was not declared in this scope
10 | return h;
| ^
a.cc:12:14: error: 't' was not declared in this scope
12 | return t;
| ^
a.cc:16:14: error: 'h' was not declared in this scope
16 | return h;
| ^
a.cc:18:12: error: 't' was not declared in this scope
18 | return t;
| ^
a.cc: In function 'int main()':
a.cc:23:12: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
23 | string g='Alice',h='Bob',t='Draw';
| ^~~~~~~
a.cc:23:22: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
23 | string g='Alice',h='Bob',t='Draw';
| ^~~~~
a.cc:23:30: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
23 | string g='Alice',h='Bob',t='Draw';
| ^~~~~~
|
s785247442 | p03803 | C++ | #include<iostream>
#include<string>
using namespace std;
int sum(int a,int b){
string g="Draw",h="Alice",t="Bob";
if(a==b)
return g;
else if(a!=1||b!=1){
if(a>b)
return h;
else
return t;
}
else{
if(a==1)
return h;
else
return t;
}
}
int main(){
int a,b;
cin>>a>>b;
cout<<sum(a,b);
return 0;
}
| a.cc: In function 'int sum(int, int)':
a.cc:7:12: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
7 | return g;
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:10:14: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
10 | return h;
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:12:14: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
12 | return t;
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:16:14: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
16 | return h;
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:18:12: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
18 | return t;
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
|
s997472707 | p03803 | C++ | #include<iostream>
#include<string>
using namespace std;
int sum(int a,int b){
string g='Draw',h='Alice',t='Bob';
if(a==b)
return g;
else if(a!=1||b!=1){
if(a>b)
return h;
else
return t;
}
else{
if(a==1)
return h;
else
return t;
}
}
int main(){
int a,b;
cin>>a>>b;
cout<<sum(a,b);
return 0;
}
| a.cc:5:12: warning: multi-character character constant [-Wmultichar]
5 | string g='Draw',h='Alice',t='Bob';
| ^~~~~~
a.cc:5:21: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
5 | string g='Draw',h='Alice',t='Bob';
| ^~~~~~~
a.cc:5:31: warning: multi-character character constant [-Wmultichar]
5 | string g='Draw',h='Alice',t='Bob';
| ^~~~~
a.cc: In function 'int sum(int, int)':
a.cc:5:12: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
5 | string g='Draw',h='Alice',t='Bob';
| ^~~~~~
a.cc:5:21: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
5 | string g='Draw',h='Alice',t='Bob';
| ^~~~~~~
a.cc:5:31: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
5 | string g='Draw',h='Alice',t='Bob';
| ^~~~~
a.cc:7:12: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
7 | return g;
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:10:14: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
10 | return h;
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:12:14: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
12 | return t;
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:16:14: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
16 | return h;
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:18:12: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
18 | return t;
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
|
s911585535 | p03803 | C++ | #include<iostream>
#include<string>
using namespace std;
int sum(int a,int b){
string g='Draw',h='Alice',t='Bob';
if(a==b)
return g;
else if(a!=1||b!=1){
if(a>b)
return h;
else
return t;
}
else{
if(a==1)
return 'Alice';
else
return 'Bob';
}
}
int main(){
int a,b;
cin>>a>>b;
cout<<sum(a,b);
return 0;
}
| a.cc:5:12: warning: multi-character character constant [-Wmultichar]
5 | string g='Draw',h='Alice',t='Bob';
| ^~~~~~
a.cc:5:21: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
5 | string g='Draw',h='Alice',t='Bob';
| ^~~~~~~
a.cc:5:31: warning: multi-character character constant [-Wmultichar]
5 | string g='Draw',h='Alice',t='Bob';
| ^~~~~
a.cc:16:14: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
16 | return 'Alice';
| ^~~~~~~
a.cc:18:12: warning: multi-character character constant [-Wmultichar]
18 | return 'Bob';
| ^~~~~
a.cc: In function 'int sum(int, int)':
a.cc:5:12: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
5 | string g='Draw',h='Alice',t='Bob';
| ^~~~~~
a.cc:5:21: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
5 | string g='Draw',h='Alice',t='Bob';
| ^~~~~~~
a.cc:5:31: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
5 | string g='Draw',h='Alice',t='Bob';
| ^~~~~
a.cc:7:12: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
7 | return g;
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:10:14: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
10 | return h;
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:12:14: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in return
12 | return t;
| ^
| |
| std::string {aka std::__cxx11::basic_string<char>}
|
s305830942 | p03803 | C++ | #include <iostream>
#include <string>
#include <set>
#include <regex>
using namespace std;
int main () {
int n, m;
cin >> n, m;
n = (n!=1 ? n-1 : 13);
m = (m1=1 ? m-1 : 13);
cout << (n == m ? "Draw" : (n > m ? "Alice" : "Bob")) << endl;
} | a.cc: In function 'int main()':
a.cc:11:8: error: 'm1' was not declared in this scope; did you mean 'm'?
11 | m = (m1=1 ? m-1 : 13);
| ^~
| m
|
s029457866 | p03803 | C++ | #include<iostream>
using namespace std;
int sum(int a,int b){
if(a==b)
return "Draw";
else if(a!=1||b!=1){
if(a>b)
return "Alice";
else
return "Bob";
}
else{
if(a==1)
return "Alice";
else
return "Bob";
}
}
int main(){
int a,b;
cin>>a>>b;
cout<<sum(a,b);
return 0;
}
| a.cc: In function 'int sum(int, int)':
a.cc:5:12: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
5 | return "Draw";
| ^~~~~~
| |
| const char*
a.cc:8:14: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
8 | return "Alice";
| ^~~~~~~
| |
| const char*
a.cc:10:14: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
10 | return "Bob";
| ^~~~~
| |
| const char*
a.cc:14:14: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
14 | return "Alice";
| ^~~~~~~
| |
| const char*
a.cc:16:12: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
16 | return "Bob";
| ^~~~~
| |
| const char*
|
s121891760 | p03803 | C++ | #include<iostream>
using namespace std;
int sum(int a,int b){
if(a=b)
return "Draw";
else if(a!=1||b!=1){
if(a>b)
return "Alice";
else
return "Bob";
}
else
if(a==1)
return "Alice";
else
return "Bob";
}
int main(){
int a,b;
cin>>a>>b;
cout<<sum(a,b);
return 0;
} | a.cc: In function 'int sum(int, int)':
a.cc:5:12: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
5 | return "Draw";
| ^~~~~~
| |
| const char*
a.cc:8:14: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
8 | return "Alice";
| ^~~~~~~
| |
| const char*
a.cc:10:14: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
10 | return "Bob";
| ^~~~~
| |
| const char*
a.cc:14:14: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
14 | return "Alice";
| ^~~~~~~
| |
| const char*
a.cc:16:12: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
16 | return "Bob";
| ^~~~~
| |
| const char*
|
s546317784 | p03803 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin >> a >> b;
int x=1;
if(a==b){
cout << "DRAW" << endl;
}
}else if(a==x || a>b){
cout << "Alice" << endl;
}else if(b==x || a<b){
cout << "Bob" << endl;
}
return 0;
} | a.cc:11:10: error: expected unqualified-id before 'else'
11 | }else if(a==x || a>b){
| ^~~~
a.cc:13:10: error: expected unqualified-id before 'else'
13 | }else if(b==x || a<b){
| ^~~~
a.cc:17:9: error: expected unqualified-id before 'return'
17 | return 0;
| ^~~~~~
a.cc:18:1: error: expected declaration before '}' token
18 | }
| ^
|
s765182683 | p03803 | C++ | int main()
{
int a, b;
cin >> a >> b;
if (a==b||a==b==1)
cout << "Draw";
else if (a > b&&b!=1 ||( a == 1&& b>a))
cout << "Alice";
else if (a < b ||( b == 1&&a>b))
cout << "Bob";
} | a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
4 | cin >> a >> b;
| ^~~
a.cc:6:17: error: 'cout' was not declared in this scope
6 | cout << "Draw";
| ^~~~
a.cc:8:17: error: 'cout' was not declared in this scope
8 | cout << "Alice";
| ^~~~
a.cc:10:17: error: 'cout' was not declared in this scope
10 | cout << "Bob";
| ^~~~
|
s572758876 | p03803 | C++ | using namespace std;
int main()
{
int n,m;
cin>>n>>m;
if(n==1)
{
n=14;
}
if(m==1)
{
m=14;
}
if(n==m)
{
cout<<"Draw";
}
else if(n<m)
{
cout<<"Bob";
}
else
{
cout<<"Alice";
}
return 0; } | a.cc: In function 'int main()':
a.cc:5:6: error: 'cin' was not declared in this scope
5 | cin>>n>>m;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:16:10: error: 'cout' was not declared in this scope
16 | cout<<"Draw";
| ^~~~
a.cc:16:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:10: error: 'cout' was not declared in this scope
20 | cout<<"Bob";
| ^~~~
a.cc:20:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:10: error: 'cout' was not declared in this scope
24 | cout<<"Alice";
| ^~~~
a.cc:24:10: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
|
s740436570 | p03803 | C++ | #include <iostream>
using namespace std;
int main()
{
int A,B;
cin>>A>>B;
if(A>B)
{
if(B==1)
cout<<"Bob";
else
cout<<"Alice";
}
else if(B>A)
{a
if(A==1)
cout<<"Alice";
else
cout<<"Bob";
}
else
cout<<"Draw";
return 0;
} | a.cc: In function 'int main()':
a.cc:17:10: error: 'a' was not declared in this scope
17 | {a
| ^
a.cc:20:17: error: expected '}' before 'else'
20 | else
| ^~~~
a.cc:17:9: note: to match this '{'
17 | {a
| ^
a.cc: At global scope:
a.cc:23:9: error: expected unqualified-id before 'else'
23 | else
| ^~~~
a.cc:25:9: error: expected unqualified-id before 'return'
25 | return 0;
| ^~~~~~
a.cc:26:1: error: expected declaration before '}' token
26 | }
| ^
|
s760591565 | p03803 | C++ | #include <iostream>
using namespace std;
int main()
{
int A,B;
cin>>A>>B;
if(A>B)
{
if(B==1)
cout<<"Bob";
else
cout<<"Alice";
}
else if(B>A)
{a
if(A==1)
cout<<"Alice";
else
cout<<"Bob";
}
else
cout<<"Draw";
return 0;
} | a.cc: In function 'int main()':
a.cc:17:10: error: 'a' was not declared in this scope
17 | {a
| ^
a.cc:20:17: error: expected '}' before 'else'
20 | else
| ^~~~
a.cc:17:9: note: to match this '{'
17 | {a
| ^
a.cc: At global scope:
a.cc:23:9: error: expected unqualified-id before 'else'
23 | else
| ^~~~
a.cc:25:9: error: expected unqualified-id before 'return'
25 | return 0;
| ^~~~~~
a.cc:26:1: error: expected declaration before '}' token
26 | }
| ^
|
s641745501 | p03803 | C | #include <iostream>
#include <bits/c++io.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
if(x==y)
cout<<"Draw"<<endl;
else if(x==1) cout<<"Alice"<<endl;
else if(y==1) cout<<"Bob"<<endl;
else {
if(x>y) cout<<"Alice"<<endl;
else cout<<"Bob"<<endl;
}
}
| main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s348859291 | p03803 | C++ | #include<bits/stdc++>h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
if(a==1){
a+=13;
}
if(b==1){
b+=13;
}
if(a>b){cout<<"Alice"<<endl;}
else if(a==b){cout<<"Draw"<<endl;}
else{cout<<"Bob"<<endl;}
} | a.cc:1:23: warning: extra tokens at end of #include directive
1 | #include<bits/stdc++>h>
| ^
a.cc:1:9: fatal error: bits/stdc++>: No such file or directory
1 | #include<bits/stdc++>h>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s343917895 | p03803 | C++ | 1 #include<bits/stdc++.h>
2 using namespace std;
3 #define ll long long
4 int main()
5 {
6 int n,m;
7 cin>>n>>m;
8 if(n==1)
9 {
10 n=14;
11 }
12 if(m==1)
13 {
14 m=14;
15 }
16 if(n==m)
17 {
18 cout<<"Draw";
19 }
20 else if(n<m)
21 {
22 cout<<"Bob";
23 }
24 else
25 {
26 cout<<"Alice";
27 }
28 return 0;
29 } | a.cc:1:4: error: stray '#' in program
1 | 1 #include<bits/stdc++.h>
| ^
a.cc:3:4: error: stray '#' in program
3 | 3 #define ll long long
| ^
a.cc:1:2: error: expected unqualified-id before numeric constant
1 | 1 #include<bits/stdc++.h>
| ^
a.cc:3:2: error: expected unqualified-id before numeric constant
3 | 3 #define ll long long
| ^
|
s160842453 | p03803 | C++ | 1 #include<bits/stdc++.h>
2 using namespace std;
4 int main()
5 {
6 int n,m;
7 cin>>n>>m;
8 if(n==1)
9 {
10 n=14;
11 }
12 if(m==1)
13 {
14 m=14;
15 }
16 if(n==m)
17 {
18 cout<<"Draw";
19 }
20 else if(n<m)
21 {
22 cout<<"Bob";
23 }
24 else
25 {
26 cout<<"Alice";
27 }
28 return 0;
29 } | a.cc:1:4: error: stray '#' in program
1 | 1 #include<bits/stdc++.h>
| ^
a.cc:1:2: error: expected unqualified-id before numeric constant
1 | 1 #include<bits/stdc++.h>
| ^
a.cc:4:2: error: expected unqualified-id before numeric constant
4 | 4 int main()
| ^
|
s333564425 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
signed main()
{
int A,B;
cin >> A >> B;
if(A==1) A = 14;
if(B==1) B = 14;
cout << (A>B ? "Alice": (B>A ? "Bob" : "Draw")
} | a.cc: In function 'int main()':
a.cc:13:49: error: expected ')' before '}' token
13 | cout << (A>B ? "Alice": (B>A ? "Bob" : "Draw")
| ~ ^
| )
14 | }
| ~
a.cc:13:49: error: expected ';' before '}' token
13 | cout << (A>B ? "Alice": (B>A ? "Bob" : "Draw")
| ^
| ;
14 | }
| ~
|
s002767135 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)
// vector
#define ALL(x) x.begin(), x.end()
// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
cout << a;
ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
cout << a << ' ';
}
int ans = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
int main()
{
int a, b, n, x, y;
string s, t, u;
cin >> a >> b;
if (a == 1)
pr("Alice");
else if (b == 1)
pr("Bob");
else if (a > b)
pr("Alice");
else if (b == a)
pr("Draw");
v|| a < b)
pr("Bob");
return 0;
} | a.cc: In function 'int main()':
a.cc:70:3: error: 'v' was not declared in this scope
70 | v|| a < b)
| ^
|
s759922073 | p03803 | C++ | //Bismillahir Rahmanir Rahim
#include <iostream>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
if((a == b)) {
cout<<"Draw\n";
}
else if((a == 1) || (a > b && b != 1)){
cout<<"Alice\n";
}
else if((b == 1) || (b > a && a != 1) ) {
cout<<"Bob\n";
}
return 0;
}
//Bismillahir Rahmanir Rahim
#include <iostream>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
if((a == b)) {
cout<<"Draw\n";
}
else if((a == 1) || (a > b && b != 1)){
cout<<"Alice\n";
}
else if((b == 1) || (b > a && a != 1) ) {
cout<<"Bob\n";
}
return 0;
} | a.cc:32:5: error: redefinition of 'int main()'
32 | int main()
| ^~~~
a.cc:8:5: note: 'int main()' previously defined here
8 | int main()
| ^~~~
|
s195337140 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int a , b ;
cin >> a >> b ;
if ( a ==1){
a=14;
}
if ( b ==1){
b=14;
}
cout << ( a<b ? "Bob" : ( a=b ? "Draw" : "Alice")) << endl;
}
| a.cc: In function 'int main()':
a.cc:13:33: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
13 | cout << ( a<b ? "Bob" : ( a=b ? "Draw" : "Alice")) << endl;
| ~~^~~~~~~~~~~~~~~~~~
| |
| const char*
a.cc:13:17: error: operands to '?:' have different types 'const char*' and 'int'
13 | cout << ( a<b ? "Bob" : ( a=b ? "Draw" : "Alice")) << endl;
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s068672403 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int a , b ;
cin >> a >> b ;
if ( a ==1){
a=14
}
if ( b ==1){
b=14
}
cout << ( a<b ? "Bob" : ( a=b ? "Draw" : "Alice")) << endl;
}
| a.cc: In function 'int main()':
a.cc:8:9: error: expected ';' before '}' token
8 | a=14
| ^
| ;
9 | }
| ~
a.cc:11:9: error: expected ';' before '}' token
11 | b=14
| ^
| ;
12 | }
| ~
a.cc:13:33: error: invalid conversion from 'const char*' to 'int' [-fpermissive]
13 | cout << ( a<b ? "Bob" : ( a=b ? "Draw" : "Alice")) << endl;
| ~~^~~~~~~~~~~~~~~~~~
| |
| const char*
a.cc:13:17: error: operands to '?:' have different types 'const char*' and 'int'
13 | cout << ( a<b ? "Bob" : ( a=b ? "Draw" : "Alice")) << endl;
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s776985683 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int a,b;
cin >> a >> b;
if(a==b)cout << "Draw" <<endl;
if(a==1&&(2<=b&&b<=13))cout << "Alice" <<endl;
if(b==1&&(2<=a&&a<=13))cout << "Bob" <<endl;
if(a<b&&(a=!1&&b=!13))cout << "Bob" <<endl;
if(b<a&&(b=!1&&a=!13))cout << "Alcie" <<endl;
} | a.cc: In function 'int main()':
a.cc:11:17: error: lvalue required as left operand of assignment
11 | if(a<b&&(a=!1&&b=!13))cout << "Bob" <<endl;
| ~~^~~
a.cc:12:17: error: lvalue required as left operand of assignment
12 | if(b<a&&(b=!1&&a=!13))cout << "Alcie" <<endl;
| ~~^~~
|
s005417474 | p03803 | C++ | #include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int main()
{
int x,y;
cin>>x>>y;
if(x==1){
cout<<"Alice";}
else if(y==1)
cout<<"Bob";
}
if(x>y)
cout<<"Alice";
else if(x<y)
cout<<"Bob";
else
cout<<"Draw";
return 0;
}
| a.cc:18:1: error: expected unqualified-id before 'if'
18 | if(x>y)
| ^~
a.cc:20:1: error: expected unqualified-id before 'else'
20 | else if(x<y)
| ^~~~
a.cc:22:1: error: expected unqualified-id before 'else'
22 | else
| ^~~~
a.cc:26:5: error: expected unqualified-id before 'return'
26 | return 0;
| ^~~~~~
a.cc:27:1: error: expected declaration before '}' token
27 | }
| ^
|
s357637817 | p03803 | C++ | #include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int main()
{
int x,y;
cin>>x>>y;
if(x==1){
cout<<"Alice";
else if(y==1)
cout<<"Bob";
}
if(x>y)
cout<<"Alice";
else if(x<y)
cout<<"Bob";
else
cout<<"Draw";
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:5: error: expected '}' before 'else'
14 | else if(y==1)
| ^~~~
a.cc:12:9: note: to match this '{'
12 | if(x==1){
| ^
a.cc: At global scope:
a.cc:18:1: error: expected unqualified-id before 'if'
18 | if(x>y)
| ^~
a.cc:20:1: error: expected unqualified-id before 'else'
20 | else if(x<y)
| ^~~~
a.cc:22:1: error: expected unqualified-id before 'else'
22 | else
| ^~~~
a.cc:26:5: error: expected unqualified-id before 'return'
26 | return 0;
| ^~~~~~
a.cc:27:1: error: expected declaration before '}' token
27 | }
| ^
|
s011769872 | p03803 | C++ | #include <iostream>
using namespace std;
int main() {
unsigned int a, b;
cin > a >> b;
a -= 2;
b -= 2;
if (a == b) {
cout << "Draw" << endl;
} else if (a < b) {
cout << "Bob" << endl;
} else {
cout << "Alice" << endl;
}
} | a.cc: In function 'int main()':
a.cc:6:9: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'unsigned int')
6 | cin > a >> b;
| ~~~ ^ ~~~~~~
| | |
| | unsigned int
| std::istream {aka std::basic_istream<char>}
a.cc:6:9: note: candidate: 'operator>(int, unsigned int)' (built-in)
6 | cin > a >> b;
| ~~~~^~~~~~~~
a.cc:6:9: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
6 | cin > a >> b;
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
6 | cin > a >> b;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
6 | cin > a >> b;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
6 | cin > a >> b;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
6 | cin > a >> b;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:6:16: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
6 | cin > a >> b;
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:6:16: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
6 | cin > a >> b;
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:6:16: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'unsigned int'
6 | cin > a >> b;
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
6 | cin > a >> b;
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
6 | cin > a >> b;
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:6:16: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>'
6 | cin > a >> b;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:6:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>'
6 | cin > a >> b;
| ^
|
s654216382 | p03803 | C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
void swap (int *x, int *y) {
int temp;
temp = *x;
*x = *y;
*y = temp;
}
int gcd(int a,int b){
if(a<b){
swap(&a,&b);
}
if(b==0){
return a;
}
int r=a%b;
while(r!=0){
a = b;
b = r;
r = (a%b);
}
return b;
}
/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}
int modpow(int a,int n,int mod){
int ans=1;
while(n>0){
if(n & 1){
ans=ans*a%mod;
}
a=a*a%mod;
n/=2;
}
return ans;
}
int max(int a,int b){
if(a<b){
return b;
}
else{
return a;
}
}
int min(int a,int b){
if(a<b){
return a;
}
else{
return b;
}
}
void chmax(int *a,int b){
if(*a < b){
*a = b;
}
return;
}
void chmin(int *a,int b){
if(*a > b){
*a =b;
}
return;
}
int main(void){
int a,b;
scanf("%d %d",&a,&b);
if(a==b){
printf("Draw\n");
}else if((b!=1 && a<b) || (b==1)){
printf("Bob\n");
}else if((a==1) || (a!=1 && b,a){
printf("Alice\n");
}
return 0;
} | main.c: In function 'main':
main.c:92:35: error: expected ')' before '{' token
92 | }else if((a==1) || (a!=1 && b,a){
| ~ ^
| )
main.c:96:1: error: expected expression before '}' token
96 | }
| ^
|
s312443906 | p03803 | C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
void swap (int *x, int *y) {
int temp;
temp = *x;
*x = *y;
*y = temp;
}
int gcd(int a,int b){
if(a<b){
swap(&a,&b);
}
if(b==0){
return a;
}
int r=a%b;
while(r!=0){
a = b;
b = r;
r = (a%b);
}
return b;
}
/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}
int modpow(int a,int n,int mod){
int ans=1;
while(n>0){
if(n & 1){
ans=ans*a%mod;
}
a=a*a%mod;
n/=2;
}
return ans;
}
int max(int a,int b){
if(a<b){
return b;
}
else{
return a;
}
}
int min(int a,int b){
if(a<b){
return a;
}
else{
return b;
}
}
void chmax(int *a,int b){
if(*a < b){
*a = b;
}
return;
}
void chmin(int *a,int b){
if(*a > b){
*a =b;
}
return;
}
int main(void){
int a,b;
scanf("%d %d",&a,&b);
if(a==b){
printf("Draw\n");
}else if((b<=13 && a<b) || b==1 && b<a)){
printf("Bob\n");
}else ({
printf("draw\n");
}
return 0;
} | main.c: In function 'main':
main.c:90:42: error: expected statement before ')' token
90 | }else if((b<=13 && a<b) || b==1 && b<a)){
| ^
main.c:92:4: error: 'else' without a previous 'if'
92 | }else ({
| ^~~~
main.c:94:4: error: expected ')' before 'return'
94 | }
| ^
| )
95 | return 0;
| ~~~~~~
main.c:95:12: error: expected ';' before '}' token
95 | return 0;
| ^
| ;
96 | }
| ~
|
s006044978 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
int A, B;
int main () {
cin >> A >> B;
if(A==1) A+=13;
if(B==1) B+=13;
if (A > B){
cout << "Alice" << endl;
}
if (A < B){
cout << "Bob" << endl;
}
if (A==B){
cout << "Draw" << endl;
} | a.cc: In function 'int main()':
a.cc:18:10: error: expected '}' at end of input
18 | }
| ^
a.cc:6:13: note: to match this '{'
6 | int main () {
| ^
|
s826948209 | p03803 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
int a,b
cin >> a >> b;
if(a == b){
cout << "Draw";
return 0;
}
if(a == 1){
a = 14;
}
if(b == 1){
b = 14;
}
if(a > b){
cout << "Alice";
}else{
cout << "Bob";
}
}
| a.cc: In function 'int main()':
a.cc:8:7: error: expected initializer before 'cin'
8 | cin >> a >> b;
| ^~~
a.cc:9:25: error: 'b' was not declared in this scope
9 | if(a == b){
| ^
a.cc:16:6: error: 'b' was not declared in this scope
16 | if(b == 1){
| ^
a.cc:19:10: error: 'b' was not declared in this scope
19 | if(a > b){
| ^
|
s319462447 | p03803 | C++ | #include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
//#define int long long ←保留
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) { //階乗
if (i == 0) return 1;
return (fact(i - 1)) * i;
}
int gcd(int a, int b) { //最大公約数
if (b == 0) return a;
return gcd(b, a % b);
}
int lcm(int a, int b) { //最小公倍数
return a * b / gcd(a, b);
}
int keta(int n) { //桁数を求める
if (n == 0) return 1;
int count = 0;
while (n != 0) {
n /= 10;
count++;
}
return count;
}
int ketasum(int n) { //各桁の和
int sum = 0;
while (n != 0) {
sum += n % 10;
n /= 10;
}
return sum;
}
/*-------------ここまで---------------------------------------------*/
//C++(GCC9.2.1)
/*signed*/int main(void) {
int a,b;
cin >> a >> b;
if(a==1) a+=13;
if(b==1) b+=13;
if(a>b) cout << "Alice" << endl;
else if(a<b) cout << "Bob" << endl;
else cout << "Draw" << endl
return 0;
} | a.cc:42:22: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
42 | const int INF = 1e18 + 9;
| ~~~~~^~~
a.cc: In function 'int main()':
a.cc:89:30: error: expected ';' before 'return'
89 | else cout << "Draw" << endl
| ^
| ;
90 | return 0;
| ~~~~~~
|
s689535008 | p03803 | C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define rep(i,n) for(i=0;i<n;i++)
#define PI 3.14159265358979323846264338327950L
int main(){
int a,b;
scanf("%d%d",&a,&b);
if(a=b) printf("Draw");
else if(a>b){
if(b==1) printf("Bob");
else printf("Alice");
}
else{
if(a==1) printf("Alice");
else printf("Bob");
return 0;
} | main.c: In function 'main':
main.c:18:1: error: expected declaration or statement at end of input
18 | }
| ^
|
s455640418 | p03803 | C | #include <stdio.h>
int main(void){
int A,B;
scanf("%d %d",&A, &B);
if (A == B){
printf("Draw");
} else if (A == 1 && 1 < B < 13 || A !=1 && B !=1 && A-B>0){
printf("Alice");
} else if ((B == 1 && 1 < A < 13 || B !=1 && A !=1 && B-A>0){
printf("Bob");
}else {
printf("Invalid!");
}
return 0;
}
| main.c: In function 'main':
main.c:10:63: error: expected ')' before '{' token
10 | } else if ((B == 1 && 1 < A < 13 || B !=1 && A !=1 && B-A>0){
| ~ ^
| )
main.c:16:14: error: expected expression before '}' token
16 | }
| ^
|
s396201592 | p03803 | C++ | #include "bits/stdc++.h"
#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};
ll mod(ll a, ll mod){
ll res = a%mod;
if(res<0)res=res + mod;
return res;
}
ll modpow(ll a, ll n, ll mod){
ll res=1;
while(n>0){
if(n&1) res=res*a%mod;
a=a*a%mod;
n>>=1;
}
return res;
}
ll modinv(ll a, ll mod){
return modpow(a, mod-2, mod);
}
ll gcd(ll a, ll b){
ll r = a%b;
if(r==0) return b;
else return gcd(b, a%b);
}
bool is_prime(ll n){
ll i = 2;
if(n==1)return false;
if(n==2)return true;
bool res = true;
while(i*i <n){
if(n%i==0){
res = false;
}
i = i+1;
}
//if(i==1)res = false;
if(n%i==0)res=false;
return res;
}
struct UnionFind{
ll N;
llvec p;
llvec cnt;
UnionFind(ll n){
N = n;
p=llvec(N);
cnt=llvec(N, 0);
rep(i, N){
p[i] = i;
cnt[i] = 1;
}
}
void con(ll a, ll b){
P at = root(a);
P bt = root(b);
if(at.second!=bt.second){
if(at.first>bt.first){
swap(at, bt);
swap(a, b);
}
p[at.second] = bt.second;
cnt[bt.second]+=cnt[at.second];
p[a]=bt.second;
}
}
P root(ll a){
ll atmp = a;
ll c=0;
while(atmp!=p[atmp]){
atmp = p[atmp];
c++;
}
p[a] = atmp;
return {c, atmp};
}
bool is_con(ll a, ll b){
P at=root(a);
P bt=root(b);
return at.second == bt.second;
}
};
struct dijkstra{
ll N;
llvec d;
vector<vector<edge>> e;
dijkstra(ll n){
N = n;
//d = llvec(N, 1e18);
e = vector<vector<edge>>(N);
}
void add_edge(ll from, ll to, ll cost){
e[from].push_back({to, cost});
}
void run(ll start){
priority_queue<P, vector<P>, greater<P>> que;
que.push({0, start});
d = llvec(N, 1e18);
d[start]=0;
while(!que.empty()){
P q = que.top();que.pop();
ll dc = q.first;
ll x = q.second;
if(dc>d[x]){
continue;
}else{
for(auto ip: e[x]){
if(d[ip.x]<=d[x]+ip.c){
continue;
}else{
d[ip.x]= d[x]+ip.c;
que.push({d[ip.x], ip.x});
}
}
}
}
}
};
/**************************************
** A main function starts from here **
***************************************/
int main(){
ll a, b;
cin >> a >> b;
a = (a==1)?14:a;
b = (b==1)?14:b;
if(a>b)cout << "Alice";
else if(a==b)cour << "Draw";
else cout << "Bob";
return 0;
}
| a.cc: In function 'int main()':
a.cc:159:16: error: 'cour' was not declared in this scope
159 | else if(a==b)cour << "Draw";
| ^~~~
|
s117013177 | p03803 | C++ | #include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
int main() {
ina a, b;
cin >> a >> b;
if(a == b) cout << "Draw\n";
else if(a == 1) cout << "Alice\n";
else if(b == 1) cout << "Bob\n";
else if(a > b) cout << "Alice\n";
else cout << "Bob\n";
}
| a.cc: In function 'int main()':
a.cc:8:3: error: 'ina' was not declared in this scope; did you mean 'int'?
8 | ina a, b;
| ^~~
| int
a.cc:9:10: error: 'a' was not declared in this scope
9 | cin >> a >> b;
| ^
a.cc:9:15: error: 'b' was not declared in this scope
9 | cin >> a >> b;
| ^
|
s510751746 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void){
int A,B;
cin >> A >>B;
if(A == B){
cout << "DRAW" <<endl;
}
else{
if(A == 1){
cout << "Alice" <<endl;
break;
}
if(B == 1){
cout << "Bob" <<endl;
break;
}
if(A - B > 0){
cout << "Alice" <<endl;
}
else{
cout << "Bob" <<endl;
}
}
} | a.cc: In function 'int main()':
a.cc:15:13: error: break statement not within loop or switch
15 | break;
| ^~~~~
a.cc:19:13: error: break statement not within loop or switch
19 | break;
| ^~~~~
|
s893491971 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
int a,b;cin>>a>>b;
if(a==b){
cout<<"Draw"<<endl;
}else if (a==1){
cout<<"Alice"<<endl;
} else if (b==1){
cout<<"Bob"<<endl;
}else if (a<b)
cout<<"Bob"<<endl;
}else{
cout<<"Alice"<<endl;
}
return 0;
}
| a.cc:18:4: error: expected unqualified-id before 'else'
18 | }else{
| ^~~~
a.cc:22:3: error: expected unqualified-id before 'return'
22 | return 0;
| ^~~~~~
a.cc:23:1: error: expected declaration before '}' token
23 | }
| ^
|
s163171064 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;cin>>a>>b;
if((a = 1 && b = 13) || (a = 13 && b = 1)){
if(a =1) cout<<"Alice"<<endl;
else cout<<"Bob"<<endl;
}
else{
if(a > b) cout<<"Alice"<<endl;
else if(a < b) cout<<"Bob"<<endl;
else cout<<"Draw"<<endl;
}
} | a.cc: In function 'int main()':
a.cc:6:13: error: lvalue required as left operand of assignment
6 | if((a = 1 && b = 13) || (a = 13 && b = 1)){
| ~~^~~~
a.cc:6:35: error: lvalue required as left operand of assignment
6 | if((a = 1 && b = 13) || (a = 13 && b = 1)){
| ~~~^~~~
|
s740402357 | p03803 | C++ | {
int a,b;
scanf("%d %d", &a, &b);
if (a == 1)
{
a = 14;
}
if (b == 1)
{
b = 14;
}
if (a > b)
{
printf("Alice");
}
else if (b > a)
{
printf("Bob");
}
else if (a == b)
{
printf("Draw");
}
} | a.cc:1:1: error: expected unqualified-id before '{' token
1 | {
| ^
|
s738664167 | p03803 | C++ | {
int a,b;
scanf("%d %d", &a, &b);
if (a == 1)
{
a = 14;
}
if (b == 1)
{
b = 14;
}
if (a > b)
{
printf("Alice");
}
else if (b > a)
{
printf("Bob");
}
else if (a == b)
{
printf("Draw");
}
} | a.cc:1:1: error: expected unqualified-id before '{' token
1 | {
| ^
|
s363249616 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,M;
cin >> N >> M;
if(N==1){
N=14;
}
if(M==1){
M=14
}
else if(N<M){
cout << "Bob" << endl;
}
else if(N==M){
cout << "Draw" << endl;
}
else{
cout << "Alice" << endl;
}
}
| a.cc: In function 'int main()':
a.cc:11:9: error: expected ';' before '}' token
11 | M=14
| ^
| ;
12 | }
| ~
|
s818463428 | p03803 | C++ | #include <iostream>
using namespace std;
int main() {
int A, B; cin >> A >> B;
int Bob = 0, Alice = 0;
for (int i = 1; i <= 13; i++) {
if (A == i) Alice = i;
if (B == i) Bob = i;
if (i == 1 && A == 1) A += 100;
if (i == 1 && B == 1) B += 100
}
if (Alice > Bob) printf("%s\n", "Alice");
else if (Alice == Bob) printf("%s\n", "Draw");
else printf("%s\n", "Bob");
} | a.cc: In function 'int main()':
a.cc:10:39: error: expected ';' before '}' token
10 | if (i == 1 && B == 1) B += 100
| ^
| ;
11 | }
| ~
|
s259674227 | p03803 | C++ | #include <iostream>
using namespace std;
int main() {
int A, B; cin >> A >> B;
int Bob = 0, Alice = 0;
for (int i = 1; i <= 13; i++) {
if (A == i) Alice = i;
if (B == i) Bob = i;
if (i == 1 && A == 1) A += 100;
if (i == 1 && B == 1) B += 100
}
if (Alice > Bob) printf("%s\n", "Alice");
else if (Alice == Bob) printf("%s\n", "Draw");
else printf("%s\n", "Bob");
} | a.cc: In function 'int main()':
a.cc:10:39: error: expected ';' before '}' token
10 | if (i == 1 && B == 1) B += 100
| ^
| ;
11 | }
| ~
|
s732582671 | p03803 | C++ | #include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string a, b;
cin >> a >> b;
if(a>b && !(a==13 && b==1)) cout<<"Alice";
else if(a==b) cout<<"Draw";
else cout<<"Bob";
} | a.cc: In function 'int main()':
a.cc:11:16: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ~^~~~
| | |
| | int
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
In file included from /usr/include/c++/14/string:43,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
/usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: mismatched types 'const _CharT*' and 'int'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3819 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>'
11 | if(a>b && !(a==13 && b==1)) cout<<"Alice";
| ^~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
| ^~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed:
a.cc:11:18: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>'
11 | if(a>b |
s040489967 | p03803 | C++ | #include <iostream>
using namespace std;
int main(){
int a, b
cin >> a >> b;
if (b == 1) b = 14;
if (a > b) cout << "Alice\n";
else if (b > a) cout << "Bob\n";
else cout << "Draw\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:7:3: error: expected initializer before 'cin'
7 | cin >> a >> b;
| ^~~
a.cc:8:7: error: 'b' was not declared in this scope
8 | if (b == 1) b = 14;
| ^
a.cc:9:11: error: 'b' was not declared in this scope
9 | if (a > b) cout << "Alice\n";
| ^
|
s171586322 | p03803 | C++ | #include <iostream>
using namespace std;
int main(void){
// Your code here!
int A, B;
cin >>A >>B;
if(A < B)
{
if(A == 1)
printf("Alice");
else
printf("Bob")
}
if(A > B)
{
if(B == 1)
printf("Bob")
else
printf("Alice")
}
if(A == B)
printf("Draw")
}
| a.cc: In function 'int main()':
a.cc:13:21: error: expected ';' before '}' token
13 | printf("Bob")
| ^
| ;
14 | }
| ~
a.cc:18:21: error: expected ';' before 'else'
18 | printf("Bob")
| ^
| ;
19 | else
| ~~~~
a.cc:23:18: error: expected ';' before '}' token
23 | printf("Draw")
| ^
| ;
24 | }
| ~
|
s523764335 | p03803 | C++ | #include <iostream>
using namespace std;
int main(void){
// Your code here!
int A,B;
cin >> A,B;
if ((A>1)>(B>1))
cout << "Alice" << endl;
else if ((A>1)<(B>1))
cout << "Bob" << endl;
else if (A==1)
cout << "Alice" << endl:
else if (B==1)
cout << "Bob" << endl;
} | a.cc: In function 'int main()':
a.cc:12:29: error: expected ';' before ':' token
12 | cout << "Alice" << endl:
| ^
| ;
|
s195629639 | p03803 | C | #include<stdio,h>
int main()
{
int a,b;
scanf("%d%d",&a,&b);
if(a==1)a=14;
if(b==1)b=14;
if(a>b)printf("Alice\n");
else if(a<b)printf("Bob\n");
else printf("Draw\n");
return 0;
}
| main.c:1:9: fatal error: stdio,h: No such file or directory
1 | #include<stdio,h>
| ^~~~~~~~~
compilation terminated.
|
s611412247 | p03803 | C++ | #include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
//inline int read(){int t = 0;int neg=1;char c;while((c=getchar_unlocked())!='\n'&&c!=' '&&c!=EOF){if(c=='-'){neg=-1;continue;}t=t*10+c-48;}return neg*t;}
//inline int readl(){long long t = 0;long long neg=1ll;char c;while((c=getchar_unlocked())!='\n'&&c!=' '&&c!=EOF){if(c=='-'){neg=-1ll;continue;}t=t*10+c-48;}return neg*t;}
#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';
typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pi;
typedef pair<lli,lli> plli;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector<pi> vpi;
typedef vector<plli> vplli;
const lli M=1000000007ll;
int main(){
fast_io
int a,b;
cin>>a>>b;
if(a==1 and b==1) cout<<"Draw";
else if(a==1) cout<<"Alice";
else if(b==2) cout<<"Bob";
else if(a>b) cout<<<"Alice";
else if(b>a) cout<<"Bob";
else cout<<"Draw";
return 0;
} | a.cc: In function 'int main()':
a.cc:40:28: error: expected primary-expression before '<' token
40 | else if(a>b) cout<<<"Alice";
| ^
|
s631425419 | p03803 | C++ | #include<bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
int[13] list = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1};
int anum, bnum;
for (int i = 0; i < 13; i++) {
if (a == list[i]) {
anum = i;
}
if (b == list[i]) {
bnum = i;
}
}
if (anum < bnum) {
cout << 'Bob';
} else if (anum > bnum) {
cout << "Alice";
} else {
cout << "Draw";
}
return 0;
} | a.cc:18:17: warning: multi-character character constant [-Wmultichar]
18 | cout << 'Bob';
| ^~~~~
a.cc: In function 'int main()':
a.cc:7:9: error: expected identifier before numeric constant
7 | int[13] list = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1};
| ^~
a.cc:7:9: error: expected ']' before numeric constant
7 | int[13] list = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1};
| ^~
| ]
a.cc:7:8: error: structured binding declaration cannot have type 'int'
7 | int[13] list = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1};
| ^
a.cc:7:8: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:7:8: error: empty structured binding declaration
a.cc:7:13: error: expected initializer before 'list'
7 | int[13] list = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1};
| ^~~~
a.cc:10:22: error: missing template arguments before '[' token
10 | if (a == list[i]) {
| ^
a.cc:13:22: error: missing template arguments before '[' token
13 | if (b == list[i]) {
| ^
|
s363599164 | p03803 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
string ans;
if(a==b){
ans="Draw";
break;
}
else if(a==1){
ans="Alice";
break;
}
else if(b==1){
ans="Bob";
break;
}
else if(a<b){
ans="Bob";
}
else{
ans="Alice";
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:9:5: error: break statement not within loop or switch
9 | break;
| ^~~~~
a.cc:13:5: error: break statement not within loop or switch
13 | break;
| ^~~~~
a.cc:17:5: error: break statement not within loop or switch
17 | break;
| ^~~~~
|
s632032853 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
if (a == b){
cout << "draw";
} else if (a == 1) {
cout << "Alice" << endl;
} else if (b == 1) {
cout << "Bob" << endl;
} else if (a > b){
cout << "Alice" << endl;
} else {
cou << "Bob" << endl;
}
} | a.cc: In function 'int main()':
a.cc:18:9: error: 'cou' was not declared in this scope; did you mean 'cos'?
18 | cou << "Bob" << endl;
| ^~~
| cos
|
s162470356 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int A,B;
cin>>A>>B;
if()
if(A==B)
cout<<"Draw"<<endl;
else if((A>B && B!=1) || A==1)
cout<<"Alice"<<endl;
else
cout<<"Bob"<<endl;
} | a.cc: In function 'int main()':
a.cc:7:6: error: expected primary-expression before ')' token
7 | if()
| ^
|
s978389821 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int A,B;
cin>>A>>B;
if(A>B)
cout<<"Alice"<<endl;
else if(A==B)
cout<<"Draw"<<endl;
else
cout<<Bob<<endl;
} | a.cc: In function 'int main()':
a.cc:12:11: error: 'Bob' was not declared in this scope
12 | cout<<Bob<<endl;
| ^~~
|
s458924212 | p03803 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
int main() {
int A,B;cin>>A>>B;
if(A==1&&B!=1) cout << "Alice" << endl;
if(A==1&&B==1) cout << "Draw" << endl;
if(A!=1&&B==1) cout << "Bob" << endl;
if(A!=1&&B!=1){
if(A>B) cout << "Alice" << endl;
if(A<B) cout << "Bob" << endl;
if(A==B) cout << "Draw" << end;
}
} | a.cc: In function 'int main()':
a.cc:14:29: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
14 | if(A==B) cout << "Draw" << end;
| ~~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std:: |
s493531436 | p03803 | C++ | #include <bits/stdc++.h>
#define rep(i,n); for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
long double pi = acos(-1);
const int INF = 1001001001;
// 最小公倍数を求める
int euqlid (int a, int b){
int temp;
temp = a % b;
if(temp == 0)return b;
return euqlid(b,temp);
}
ll conbination(ll a,ll b){
ll u = 1;
ll d = 1;
while(b != 0){
u *= a;
d *= b;
a--;
b--;
}
return u / d;
}
int strtoint(char s){
return (int(s-'0'));
}
char changeS(char alpha){
if(0x41 <= alpha and alpha <= 0x5A)return (alpha + 0x20);
else if(0x61 <= alpha and alpha <= 0x7A)return (alpha - 0x20);
return alpha;
}
int fact(int n){
if(n == 1)return 1;
return n * fact(n-1);
}
int main(){
int a,b;
cin >> a >> b;
int strength[13];
strength[12] = 14;
rep(i,12)strength[] = i+2;
string ans = "Draw";
if(strength[a] > strength[b])ans = "Alice";
else if(strength[a] < strength[b])ans = "Bob";
cout << ans <<endl;
}
| a.cc: In function 'int main()':
a.cc:48:21: error: expected primary-expression before ']' token
48 | rep(i,12)strength[] = i+2;
| ^
|
s590538216 | p03803 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
#define MODSIZE 1000000007
int main(){
int a,b;
scanf("%d %d", &a, &b);
if(a == b) printf("Draw\n");
else if(a == 1) printf("Alice\n");
else if(b == 1) printf("Bob\n");
else if(a < b) printf("Bob\n");
else printt("Alice\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:15:8: error: 'printt' was not declared in this scope; did you mean 'printf'?
15 | else printt("Alice\n");
| ^~~~~~
| printf
|
s439243336 | p03803 | C++ | /******* all required header files *******/
#include<iostream>
#include<algorithm>
#include<cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
/*****All definitions*******/
#define w(t) int t; cin>>t; while(t--)
#define vi vector<int>
#define vs vector<string>
#define mp make_pair
#define ll long long int
/***************************/
int main()
{
/*#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif*/
ios_base::sync_with_stdio(0);
cin.tie(0);
int a, b;
cin>>a>>b;
if(a > b && b != 1)
cout<<"Alice";
if(a == 1 && b != 1)
cout<<"Alice";
if(b > a && a != 1)
cout<<"Bob";
if(b == 1 && a != 1)
cout<<"Bob";
if(a == 1 && b == 1)
cout<<"Draw";
return 0;
}
}
| a.cc:61:1: error: expected declaration before '}' token
61 | }
| ^
|
s865147621 | p03803 | C++ | nnnnnnnnnnn | a.cc:1:1: error: 'nnnnnnnnnnn' does not name a type
1 | nnnnnnnnnnn
| ^~~~~~~~~~~
|
s426266500 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> a >> b;
if (a == 1) {
a = 14;
}
if (b == 1) {
b = 14;
}
if (a > b) {
cout << "Alice\n';"
}
else if (b > a) {
cout << "Bob\n";
}
else {
cout << "Draw\n";
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:36: error: expected ';' before '}' token
22 | cout << "Alice\n';"
| ^
| ;
23 | }
| ~
|
s612192236 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int A,B;
cin >> A >> B;
if(A!=1 &&B!=1 &&A<B){
cout << "Bob" << endl;
}
else if(A!=1 && B!=! && A>B){
cout << "Alice" << endl;
}
else if(A!=1 && B==1){
cout << "Bob" << endl;
}
else if (A==1&&B!=1){
cout << "Alice" << endl;
}
else{
cout << "Draw" << endl;
}
} | a.cc: In function 'int main()':
a.cc:11:27: error: label 'A' used but not defined
11 | else if(A!=1 && B!=! && A>B){
| ^
|
s905380322 | p03803 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b; cin >> a >> b;
if(a>b) cout << "Alice" << endl;
else if(a<b) cout << "Bob" endl;
else cout << "Draw" << endl;
}
| a.cc: In function 'int main()':
a.cc:7:29: error: expected ';' before 'endl'
7 | else if(a<b) cout << "Bob" endl;
| ^~~~~
| ;
|
s773221497 | p03803 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(long long i = 0; i < (n) ; ++i)
#define orep(i,n) for(long long i = 1; i <= (n); ++i) // one rep
#define drep(i,n) for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i) // set rep
#define rng(x) (x).begin(),(x).end()
// range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)
using namespace std;
template<typename T> void Yes(T flag) {
cout << (flag ? "Yes" : "No") << endl;
}
template<typename T> void pv(vector<T> vec) {
cout << "[";
for(auto& v : vec) { cout << v << ","; }
cout << "]" << endl;
}
template<>
void pv(vector<P> vec) {
cout << "[";
for(auto& v : vec) {
cout << "<" << v.fi << ","<< v.se << ">" << ",";
}
cout << "]" << endl;
}
template<typename T> void pv2(vector<vector<T>> vec) {
for(auto& v : vec) pv(v);
}
int main() {
int a,b;
cin >> a >> b;
if(a==1 and b ==1) cout << "Draw" << endl;
else if(b==1) cout << "Bob" << endl;
else if (a==1) cout << "Alice" << endl;
else if(a<b) cout << "Bob" << endl;
else if (b<a) cout << "Alice" << endl;
else cout << "Draw" << endl;
return 0;
}
| a.cc:30:16: error: 'P' was not declared in this scope
30 | void pv(vector<P> vec) {
| ^
a.cc:30:17: error: template argument 1 is invalid
30 | void pv(vector<P> vec) {
| ^
a.cc:30:17: error: template argument 2 is invalid
a.cc:30:6: error: template-id 'pv<>' for 'void pv(int)' does not match any template declaration
30 | void pv(vector<P> vec) {
| ^~
a.cc:23:27: note: candidate is: 'template<class T> void pv(std::vector<_Tp>)'
23 | template<typename T> void pv(vector<T> vec) {
| ^~
|
s519349193 | p03803 | C++ | #include <bits/stdc++.h>
#define rep(i,n) for(long long i = 0; i < (n) ; ++i)
#define orep(i,n) for(long long i = 1; i <= (n); ++i) // one rep
#define drep(i,n) for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i) // set rep
#define rng(x) (x).begin(),(x).end()
// range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)
using namespace std;
template<typename T> void Yes(T flag) {
cout << (flag ? "Yes" : "No") << endl;
}
template<typename T> void pv(vector<T> vec) {
cout << "[";
for(auto& v : vec) { cout << v << ","; }
cout << "]" << endl;
}
template<>
void pv(vector<P> vec) {
cout << "[";
for(auto& v : vec) {
cout << "<" << v.fi << ","<< v.se << ">" << ",";
}
cout << "]" << endl;
}
template<typename T> void pv2(vector<vector<T>> vec) {
for(auto& v : vec) pv(v);
}
int main() {
int a,b;
cin >> a >> b;
if(a==1 and b ==1) cout << "Draw" << endl;
else if(b==1) cout << "Bob" << endl;
else if (a==1) cout << "Alice" << endl;
else if(a<b) cout << "Bob" << endl;
else if (b<a) cout << "Alice" << endl;
else cout << "Draw" << endl;
return 0;
}
| a.cc:30:16: error: 'P' was not declared in this scope
30 | void pv(vector<P> vec) {
| ^
a.cc:30:17: error: template argument 1 is invalid
30 | void pv(vector<P> vec) {
| ^
a.cc:30:17: error: template argument 2 is invalid
a.cc:30:6: error: template-id 'pv<>' for 'void pv(int)' does not match any template declaration
30 | void pv(vector<P> vec) {
| ^~
a.cc:23:27: note: candidate is: 'template<class T> void pv(std::vector<_Tp>)'
23 | template<typename T> void pv(vector<T> vec) {
| ^~
|
s739049114 | p03803 | C++ | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEL 2e9
#define PIE 3.14159265358979323
template <class T>
inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template <class T>
inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}
//困ったら全探索
//全探索をしろ
//範囲を絞ればACするはずだ
int main(){
int a,b;
cin>>a>>b;
if(a!=1&&b!=1){
if (a>b)
cout << "Alice" << endl;
else if (a==b)
cout << "draw" << endl;
else
cout << "Bob" << end;
}
else if (a==1&&b==1)
cout << "draw" << endl;
else if (a==1)
cout << "Alice" << endl;
else
cout << "Bob" << endl;
} | a.cc: In function 'int main()':
a.cc:45:27: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
45 | cout << "Bob" << end;
| ~~~~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]'
306 | operator<<(nullptr_t)
| ^~~~~~~~
/usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::nullptr_t'
306 | operator<<(null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.