简体中文
Telegram

帖子import java.util.*;

2025年10月8日
D
Deloitte | COGNIZANT | IBM | CAPGEMINI
import java.util.*; import java.io.*; class SolutionClass { private static final class FastScanner { private final InputStream in; private final byte[] buffer = new byte[1 << 16]; private int ptr = 0, len = 0; FastScanner(InputStream is) { in = is; } private int read() throws IOException { if (ptr >= len) { len = in.read(buffer); ptr = 0; if (len <= 0) return -1; } return buffer[ptr++]; } int nextInt() throws IOException { int c, sgn = 1, x = 0; do c = read(); while (c <= ' '); if (c == '-') { sgn = -1; c = read(); } while (c > ' ') { x = x * 10 + (c - '0'); c = read(); } return x * sgn; } } public static void main(String[] args) throws Exception { FastScanner fs = new FastScanner(System.in); int N = fs.nextInt(); int[] a = new int[N + 1]; for (int i = 1; i <= N; i++) a[i] = fs.nextInt(); int L = fs.nextInt(); int R = fs.nextInt(); long[] pref = new long[N + 1]; for (int i = 1; i <= N; i++) pref[i] = pref[i - 1] + a[i]; TreeMap<Long, Integer> multiset = new TreeMap<>(); long best = Long.MAX_VALUE; for (int j = 1; j <= N; j++) { int addIdx = j - L; if (addIdx >= 0) { long val = pref[addIdx]; multiset.put(val, multiset.getOrDefault(val, 0) + 1); } int remIdx = j - R - 1; if (remIdx >= 0) { long val = pref[remIdx]; int cnt = multiset.getOrDefault(val, 0); if (cnt <= 1) multiset.remove(val); else multiset.put(val, cnt - 1); } if (!multiset.isEmpty()) { Long candidateStart = multiset.lowerKey(pref[j]); if (candidateStart != null) { long sum = pref[j] - candidateStart; if (sum < best) best = sum; } } } System.out.println(best == Long.MAX_VALUE ? -1 : best); } } //sequence of consecutive stones✅
1.3K ·

信息流中的邻近内容

DDeloitte | COGNIZANT | IBM | CAPGEMINICapgemini✅✅ contact : @MLCODER2DDeloitte | COGNIZANT | IBM | CAPGEMINIimport java.io.*; class SolutionClass { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(S
这条消息
DDeloitte | COGNIZANT | IBM | CAPGEMINICAPGEMINI ON-CAMPUS EXAM DONE SUCCESSFULLY✅✅ CONTACT : @MLCODER2DDeloitte | COGNIZANT | IBM | CAPGEMINIUBER✅✅ Contact : @MLCODER2

来自搜索索引的公开信息流 ChatCrawler ——“公开 Telegram 的 Google”;随着该社群被抓取而更新。 时间为 UTC。

仅限公开内容,使用 Telegram 官方 API。 关于 · 常见问题 · 索引限制 · 移除页面 · 目录 · 搜索 · 计算方法