建议评橙

P2356 弹珠游戏

@[William2019](/user/787512) 您说的对,但是 > 保证容身之地的数量小于 $10000$。 这句话表明使最多运行 $10000(10^4) \times 10^3=10^7$。
by FiraCode @ 2023-12-26 20:03:52


偶我曹八嘎牛波一
by qusia_MC @ 2023-12-28 13:18:41


就比如说这种代码效率更好,笔算$n \leq 5 \times10^3$且时限1s, 或规模不变且时限100ms 都没有问题。 [我的记录](https://www.luogu.com.cn/record/143060577) ```cpp #include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 50,maxs = 1e4 + 50; struct node{ int x; int y; }s[maxs]; int n,cnt = 0,ans = 0; int a[maxn][maxn]; int x[maxn],y[maxn]; int main(){ scanf("%d",&n); for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { scanf("%d",&a[i][j]); if (a[i][j] != 0) { x[i] += a[i][j]; y[j] += a[i][j]; } if (a[i][j] == 0) s[++cnt] = {i,j}; } } if (cnt == 0) { printf("Bad Game!"); return 0; } for (int i = 1; i <= cnt; i++) ans = max(ans,x[s[i].x] + y[s[i].y]); printf("%d",ans); return 0; } ```
by liuruiqing @ 2024-01-16 21:10:48


@[William2019](/user/787512)
by liuruiqing @ 2024-01-17 15:34:42


|