1 条题解
-
1
暴力
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; const int N = 20005; int pos[N], a[N], ans, k, n, t; int main() { // freopen("build.in", "r", stdin); // freopen("build.out", "w", stdout); scanf("%d%d", &t, &n); for (int cnt = 1; cnt <= t; cnt ++) { int sum = 0; for (int i = 1; i <= n; i ++) scanf("%d", a + i), pos[a[i]] = i; for (int i = 1; i <= n; i ++) for (int j = i + 1; j <= n; j ++) { if (a[j] + (a[j] - a[i]) > n || a[j] + (a[j] - a[i]) < 1) continue; int l = pos[a[j] + (a[j] - a[i])]; if (a[j] - a[i] == a[l] - a[j] && i < j && j < l) sum ++; } if (sum > ans) ans = sum, k = cnt; } cout << k << ' ' << ans << '\n'; return 0; }
考试的时候没有判 ,全 qwq
- 1
信息
- ID
- 121
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 8
- 标签
- (无)
- 递交数
- 143
- 已通过
- 25
- 上传者