and sand when I am 6
and toys when I am 7
and TV when I am 8
and video games when I am 9
and programming on Codeforces and Atcoder when I am 10 and 11 (now)
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3839 |
3 | Radewoosh | 3646 |
4 | jqdai0815 | 3620 |
4 | Benq | 3620 |
6 | orzdevinwang | 3612 |
7 | Geothermal | 3569 |
7 | cnnfls_csy | 3569 |
9 | ecnerwala | 3494 |
10 | Um_nik | 3396 |
# | User | Contrib. |
---|---|---|
1 | Um_nik | 164 |
2 | maomao90 | 160 |
3 | -is-this-fft- | 159 |
4 | atcoder_official | 158 |
4 | awoo | 158 |
4 | cry | 158 |
7 | adamant | 155 |
8 | nor | 154 |
9 | TheScrasse | 151 |
9 | maroonrk | 151 |
and sand when I am 6
and toys when I am 7
and TV when I am 8
and video games when I am 9
and programming on Codeforces and Atcoder when I am 10 and 11 (now)
Problem: ABC188E
#include <bits/stdc++.h>
using namespace std;
int a[200005], f[200005];
vector<int> pre[200005];
int main() {
int n, m;
scanf("%d %d", &n, &m);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
for (int i = 0; i < m; i++) {
int x, y;
scanf("%d %d", &x, &y);
x--, y--;
pre[y].push_back(x);
}
memset(f, 0x3f, sizeof f);
int ans = -0x3f3f3f3f;
for (int i = 0; i < n; i++) {
for (int j : pre[i]) {
f[i] = min(f[i], f[j]);
f[i] = min(f[i], a[j]);
}
ans = max(ans, a[i] - f[i]);
}
printf("%d", ans);
return 0;
}
I had increase the "infinity" in array f, and I found that when f[i] = 0x3f3f3f3f + 0x3f3f2f2f, it passed , when f[i] = 0x3f3f3f3f + 0x2f2f2f2f, it WA on test #6. I had no idea about it. Could anyone give a test to hack it?
Today, I find some topics in this form......
This type of topics always say a lot of things of ******, and at last post a drawing of him/her.
So who started this type of topics???
So this is my code to ABC279F:
#include <bits/stdc++.h>
using namespace std;
int fa[600005];
void init() {
memset(fa, -1, sizeof fa);
}
int find_root(int x) {
if (fa[x] == -1) {
return x;
}
return fa[x] = find_root(fa[x]);
}
void unite(int x, int y) {
if (find_root(x) != find_root(y) && find_root(x) != -1) {
fa[find_root(x)] = find_root(y);
}
}
int now[300005], idx[300005], past[600005];
int main() {
init();
int n, q;
scanf("%d %d", &n, &q);
for (int i = 0; i < n; i++) {
now[i] = i;
past[i] = i;
idx[i] = i;
}
int cntn = n - 1;
int cnt = n - 1;
while (q--) {
int tp;
scanf("%d", &tp);
if (tp == 1) {
int x, y;
scanf("%d %d", &x, &y);
x--, y--;
unite(now[y], now[x]);
now[y] = ++cntn;
past[cntn] = y;
} else if (tp == 2) {
int x;
scanf("%d", &x);
x--;
idx[++cnt] = now[x];
} else {
int x;
scanf("%d", &x);
x--;
printf("%d\n", past[find_root(idx[x])] + 1);
}
// for (int i = 0; i < n; i++) {
// cerr << now[i] << " ";
// }
// cerr << endl;
}
return 0;
}
It should be RE (Though the size of "idx" is 300005), but it judged as WA.
Why?
And it wasted me a lot of time :(
Name |
---|