This contest is one of the qualifying contests for AtCoder World Tour Finals 2026 to crown the world champion of AtCoder players. Please refer to this post for more details. After the contest ends, all participants can post their approach on the Editorial tab. Please share your approach. We...
For a given layer, randomly decide whether to process the row part or the column part first to introduce some randomness. Store checkpoints for each layer. After getting an initial answer, roll back i states with probability 1 / (i + 1) and recalculate the layers. If we get a better a...
using namespacestd;intn;chara[MAXN]; ll sum[MAXN],f[MAXN],sum2[MAXN],ans; llpoww(ll x ,inty){ ll zz =1;while(y){if(y &1)zz = (zz * x) % mod; x = (x * x) % mod; y = y >>1; }returnzz; }intmain(){scanf("%s", a +1); n =strlen(a +1);for(inti =...
Currently, there is no one in line at the ticket booth, and N people will come to buy tickets one after another. Specifically, the i-th person will arrive at the ticket booth Ti seconds from now. If there is already a line, they will join the end of it; if not, they will start...
思路:题目挺吓人,实际非常简单,就是代码容易写错,需要调。按照题意,一步步来,首先先算出c中的1的个数,如果大于(a+b),直接结束。否则一步步构造即可(语言能力有限,just look look my code) AC Code #include<bits/stdc++.h>#define endl '\n'#define ll long long#define int long long#define pii pair...
思路感觉很对,但是他代码交。wa在了 after_contest_01.txt, 大概就是被hack了。想了半天感觉没什么问题啊,不知道为什么wa了。 经过几番研究 ,终于发现了 坑点,感谢网友提供的数据: 7 5 35 25 5 -25 -25 -25 -25 答案应该是13671875 所以 这里的坑点就是 当能凑到正数情况 且当k为奇数时 先取正数最...
The i-th person will push the switch ti seconds after the first person pushes it.How long will the shower emit water in total?题目大意给出一堆线段,问覆盖的长度是多少,升序O(n)扫一遍就好了代码#include <bits/stdc++.h> using namespace std; int n,t; int f[200010]; long long ans; ...
Find the maximum possible number of biscuits in Snuke’s pocket after KK operations. Input: Input is given from Standard Input in the following format: KK AA BB 1≤K,A,B≤1091≤K,A,B≤109 K,AK,A and BB are integers. Output: Print the maximum possible number of biscuits in Snuke’s...
AtCoder Beginner Contest 318 blackbird 来自专栏 · 算法竞赛题解 2 人赞同了该文章 A - Full Moon Problem Statement Takahashi likes full moons. Let today be day 1 . The first day on or after today on which he can see a full moon is day M . After that, he can see a full moon ever...
Streets of Torzhok are so narrow that students have to go in a row one after another. 风骨散人Chiam 2020/10/28 4970 Codeforces Round #460 (Div. 2)-A Supermaket(贪心) 对象存储linux We often go to supermarkets to buy some fruits or vegetables, and on the tag there prints the price for...