奇闻轶事:WA 了样例过了题……

P1311 [NOIP2011 提高组] 选择客栈

@[BackSlashDelta](/user/339895) ~~你见过样例过了测试点全WA的吗~~ ~~不是这道题~~
by ASOUL_Official @ 2020-10-14 23:23:43


@[BackSlashDelta](/user/339895) 有些题目样例不一定是数据
by 半只蒟蒻 @ 2020-10-14 23:32:37


--- @[lancdn](/user/301765) 这不是很常见吗…… 考虑不周就会这样。 --- @[半只蒟蒻](/user/112049) 可是我感觉这个样例没有任何问题,也就是说——如果我样例没过,大概率代码是错的。 ~~但是它过了题目和大数据……~~ ---
by BackSlashDelta @ 2020-10-14 23:39:43


@[BackSlashDelta](/user/339895) 数据是用脚造的呗
by Spasmodic @ 2020-10-14 23:43:15


--- @[happydef](/user/121027) ~~这不是 NOIP2011 吗?~~ ---
by BackSlashDelta @ 2020-10-14 23:49:53


@[BackSlashDelta](/user/339895) NOIP 用脚造数据还少吗
by 览遍千秋 @ 2020-10-14 23:51:39


所以别水了好吗…… 我是来求助的,不是在题目讨论区灌水的。
by BackSlashDelta @ 2020-10-14 23:56:32


1.我看不到你的代码,不知道你的情况 2.因此,来的人只能在这里水了 3.~~~这不是很正常吗~~~
by wocaicai @ 2020-10-15 07:15:48


@[努力AK](/user/246800) ~~awa 这样嘛我错了~~ WA 样例 AC 代码 ```cpp #include <algorithm> #include <cstdio> // Definitions // #define MAXN 10 #define MAXN 200010 #define elif else if typedef long long int64; #define File(s) freopen(#s ".in", "r", stdin), freopen(#s ".out", "w", stdout) // Variables int n, k, p, a[MAXN], b[MAXN]; int pfxcnt[55][MAXN], nxt[MAXN]; int64 ans; bool mrk; // Functions inline void Process() { for (int i = 1; i <= n; i++) { pfxcnt[a[i]][i]++; for (int j = 0; j < k; j++) { pfxcnt[j][i] += pfxcnt[j][i - 1]; } } nxt[n + 1] = n; for (int i = n; i; i--) { if (b[i] <= p) { nxt[i] = i; } else { nxt[i] = nxt[i + 1]; } } for (int i = 1; i <= n; i++) { ans += pfxcnt[a[i]][n] - pfxcnt[a[i]][nxt[i] - 1]; if (nxt[i] == i) { ans--; } } } inline void Gather() { scanf("%d%d%d", &n, &k, &p); for (int i = 1; i <= n; i++) { scanf("%d%d", a + i, b + i); } } inline void Release() { printf("%lld\n", ans); } int main(int argc, char *argv[]) { #ifndef ONLINE_JUDGE File(data); #endif Gather(); Process(); Release(); return 0; } /* */ ```
by BackSlashDelta @ 2020-10-15 14:31:59


|