随笔分类 -  AtCoder

摘要:Problem Link: https://atcoder.jp/contests/abc404/tasks/abc404_e Greedy For position i, if there exists a postion j in [i - C[i], i - 1], where A[j] > 阅读全文
posted @ 2025-05-04 11:24 Review->Improve 阅读(60) 评论(0) 推荐(0)
摘要:Problem Link If we pick A[i] the 2nd time, it means we have a cycle. Proof: 1st time we pick A[i], the sum before adding A[i] is x; 2nd time we pick A 阅读全文
posted @ 2024-08-16 08:05 Review->Improve 阅读(32) 评论(0) 推荐(0)
摘要:1. The 1st palindromic number is 0, so we do N-- to exclude 0. 2. F(k): the number of palindromic numbers of length k. F(1) = 9; F(2) = 9; F(k) = F(k 阅读全文
posted @ 2024-07-22 02:21 Review->Improve 阅读(46) 评论(0) 推荐(0)
摘要:Key idea: For a given box and a list of balls that can be placed in this box, we should choose the ball with the smallest R. Proof: say we have box B 阅读全文
posted @ 2023-10-01 02:49 Review->Improve 阅读(53) 评论(0) 推荐(0)
摘要:Incorrect solution: greedily find out how many consecutive S we can convert to all o. Then for the remaining replace operations, try each starting pos 阅读全文
posted @ 2023-09-14 05:13 Review->Improve 阅读(20) 评论(0) 推荐(0)
摘要:Problem Statment Assume the first N - 1 rounds have been played and we are left with a %7 value R. There are 2 cases depending on who plays the last r 阅读全文
posted @ 2023-09-11 06:47 Review->Improve 阅读(30) 评论(0) 推荐(0)
摘要:Problem Statement If we add edges between every pair of sets that have shared elements, there will be O(N^2) edges to traverse. Instead, we can add N 阅读全文
posted @ 2023-07-17 10:54 Review->Improve 阅读(56) 评论(0) 推荐(0)
摘要:The key observation is that there is always at most 1 cell that violates both conditions. Proof: if x violates both conditions, that means all other n 阅读全文
posted @ 2023-03-21 23:37 Review->Improve 阅读(33) 评论(0) 推荐(0)
摘要:Problem Statement dp[i][j]: the number of subsets of A[0, i] whose sum is j. dp[0][0] = 1, there is only 1 way of not picking anything from an empty a 阅读全文
posted @ 2023-02-21 01:13 Review->Improve 阅读(35) 评论(0) 推荐(0)
摘要:Problem Link: C - Mandarin Orange The problem can be converted to as such: Given an array A of positive integers, find out the the maximum product val 阅读全文
posted @ 2021-02-16 01:08 Review->Improve 阅读(114) 评论(0) 推荐(0)
摘要:Problem Link: Multiple of 2019 Key idea: For subarray S[i1, j] and S[i2, j] with i1 < i2, if the V[i1, j] % 2019 is the same with V[i2, k] % 2019, it 阅读全文
posted @ 2020-05-13 05:18 Review->Improve 阅读(217) 评论(0) 推荐(0)