56分求调

P3865 【模板】ST 表

TLE #8 ~ #12
by ZYF26 @ 2023-02-12 13:53:55


@[luogu_luogu](/user/733345) 好像没什么问题
by 大眼仔Happy @ 2023-02-12 13:58:45


@[luogu_luogu](/user/733345) 要不改成scanf试试?
by 大眼仔Happy @ 2023-02-12 14:00:02


@[大眼仔Happy](/user/537046) 已经快读了
by ZYF26 @ 2023-02-12 14:06:12


@[luogu_luogu](/user/733345) 然而我除了这个就好像和你一样了
by 大眼仔Happy @ 2023-02-12 14:06:50


@[luogu_luogu](/user/733345) ```cpp #include <bits/stdc++.h> using namespace std; int n, m, x, y; int Log[100010], dp[100010][25]; inline int read() { int f = 1, x = 0; char ch = getchar(); for(; ch < '0' || ch > '9'; ch = getchar()) if(ch == '-') f = -1; for(; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0'; return f * x; } int main() { // ios::sync_with_stdio(false); // cin.tie(0); cout.tie(0); cin >> n >> m; Log[0] = -1; Log[1] = 0; for(int i = 2; i <= n; i ++) Log[i] = Log[i >> 1] + 1; for(int i = 1; i <= n; i ++) dp[i][0] = read(); for(int j = 1; j <= Log[n]; j ++) for(int i = 1; i <= n -(1 << j) + 1; i ++) dp[i][j] = max(dp[i][j - 1], dp[i + (1 << (j - 1))][j - 1]); for(int i = 1; i <= m; i ++) { x = read(), y = read(); int l = Log[y - x + 1]; printf("%d\n", max(dp[x][l], dp[y - (1 << l) + 1][l])); } return 0; } ```
by liuzr156 @ 2023-02-12 14:09:28


@[大眼仔Happy](/user/537046) 但是现在对了10个点(共12个点)
by ZYF26 @ 2023-02-12 14:09:37


@[liuzr156](/user/685987) 所以答案就是加入那一行之后快读会变慢?
by 大眼仔Happy @ 2023-02-12 14:10:38


@[liuzr156](/user/685987) 还是56分
by ZYF26 @ 2023-02-12 14:11:26


@[大眼仔Happy](/user/537046) bushi
by ZYF26 @ 2023-02-12 14:13:53


| 下一页