inversion reverse 154e arc

ARC162E

## ARC162E ### A 简单分类讨论即可 ```cpp #include using namespace std; const int MAXN=1e3+5; int T; int n; int P[MAXN]; int main() { // freopen("date.in","r", ......
162E ARC 162

TZOJ4295--Modular Inverse

题目简述: 给你一个整数a(0<a<=1000)和一个模数m(0<m<=1000),问是否存在一个正整数x使得a*x%m=1,使x尽可能小。 标准输入 33 114 125 13 标准输出 4Not Exist8 思路1: 暴力,观察数据很显然,x的范围是0~(m-1),由于输出要求x为正整数,当x ......
Modular Inverse TZOJ 4295

【Tricks,典】[ARC085F] NRE

一眼顶针,鉴定为 **implement** 不足,我写不出来。 先通过 Trick 转化 $a_i = 0 \to -1,a_i = 1 \to 1$。 那么显然把 $[l, r]$ 全部摊为 1 的贡献就是 $a_{l \to r}$。转化为 n - 最大贡献。 然后我们可以转化以下。 $$f_ ......
Tricks 085F ARC 085 NRE

string reversal

python def reverse_string(s): return s[::-1] print(reverse_string("Hello, World!")) # Output: "!dlroW ,olleH" print(reverse_string("Python is awesome" ......
reversal string

ARC137D Prefix XORs 题解

**这里的所有下标从 $\bm 0$ 开始。** 我们考察一下每次操作后的数列 $a$ 会是什么样的。这里用 $a_i$ 前面的系数 $x$ 表示 $a_i$ 贡献了 $x$ 次,$+$ 表示异或。 $$ \begin{matrix} k=0&a_0&a_1&a_2&\cdots&a_{n-1}\\ ......
题解 Prefix 137D XORs ARC

ARC163

## ARC163 ### A 显然划分两次最优,直接枚举即可 ```cpp #include using namespace std; const int MAXN=2005; int t; int n; char s[MAXN]; int main() { // freopen("date.in ......
ARC 163

AtCoder-ARC073_A Sentou

Sentou 【题意】: 有一个开关,当按下开关后的 T 秒内会一直放水,当在放水状态时,如果有人再次按下开关,那么停止放水,并从按下的那一刻起的 T 秒会再次一直放水,给出 n 个人按压开关的时间,问总共流出多少水 【思路】: 简单模拟 #include <bits/stdc++.h> using ......
AtCoder-ARC AtCoder Sentou ARC 073

ARC149

## ARC149 ### A 直接记录$1111..$然后$check$一下即可 ```cpp #include using namespace std; const int MAXN=1e5+5; int n; int m; int Mtl[MAXN]; signed main() { // f ......
ARC 149

ARC155

## ARC155 ### A 模拟一下你会发现这个长度为$k$子串$T$会在左右依次填$S,S^{rev}$ 这个我们可以直接让$k\bmod 2n$(最开始$\bmod n$了\kk) 然后你会发现填到最后就是$T$前$n$个$S^{rev}$,后面$S$ 直接$check$一下即可 ```cp ......
ARC 155

[ARC093F] Dark Horse

Problem StatementThere are $2^N$ players, numbered $1, 2, ..., 2^N$. They decided to hold a tournament. The tournament proceeds as follows: Choose a p ......
Horse 093F Dark ARC 093

2023 *CTF reverse gorev

gorev 用ida_7.7分析一直分析不出来,得用ida free_8.3分析。 (是一道go语言逆向) 分析流程就是读入input,然后异或 v22 = encoding_base64__ptr_Encoding_EncodeToString 看到这个以及后面图片的"="判断出是base64 这 ......
reverse gorev 2023 CTF

AGC030D. Inversion Sum

双倍经验:[CF258D. Little Elephant and Broken Sorting](https://codeforces.com/problemset/problem/258/D) 好巧妙,想不到。 因为 $n$ 并不大,且直接统计显然很困难,考虑数对 $(i,j),ia_j$。 更 ......
Inversion AGC 030 Sum

ARC160

## ARC160 ### A 一眼没思路/kk 对于操作$(l1,r1)$,$(l2,r2)$我们是可以直接比较两者之间的大小的 然后用$nth\_element$即可 好像有$O(nlog(n))$做法 就是考虑每个位置的答案是什么,如果确定了前$i-1$个是没变的时候取答案,第$i$位的答案要 ......
ARC 160

题解 ARC104F

## 前言 在这里首先感谢一下题解区的 [FZzzz](https://www.luogu.com.cn/user/174045),本人的题解思路主要是基于他并给出了自己的理解。 如非特殊说明,本题解中的数学符号原则上与题目中一致。 ## 题目分析 需要转化的喵喵题。 我们需要把原问题转化成一个图论 ......
题解 104F ARC 104

ARC089B 题解

[problem](https://www.luogu.com.cn/problem/AT_arc089_b) & [blog](https://www.cnblogs.com/liangbowen/p/17599062.html)。 给一个比较暴躁的做法。 若要求 $(x,y)$ 的颜色为 Whi ......
题解 089B ARC 089

ARC157

## ARC157 ### A 简单分讨即可 ```cpp #include using namespace std; int Abs(int x) { return x>0?x:-x; } int n; int A,B,C,D; int main() { scanf("%d %d %d %d %d ......
ARC 157

ARC154

## ARC154 ### A 似乎是均值反着用,直接最大乘最小即可 ```cpp #include using namespace std; const int MOD=998244353; int n; string A,B; int main() { // freopen("date.in", ......
ARC 154

[ARC119F] AtCoder Express 3

有简单做法,但是pb大神讲了自动机做法。 这么有趣的自动机不去做?亏大发。 有两个重要的观察。 当你出现长度大于 $4$ 的连续段时,一定会向后走一次并跳过这一段。 某些时候,当你能用同样的步数走到最后的两个格子,且中一个是 $\rm A$,一个是 $B$ 时,可以看作你处于一个既能是 $\rm A ......
AtCoder Express 119F ARC 119

ARC154 E

非常好题目!!! 求和不好搞的话,我们先把他转成期望!最后再乘上 $(\frac{n(n+1)}{2})^m$。 然后拆贡献,考虑 $i$ 的系数: $$ \sum_{j\lt i}[P_j\gt P_i]-\sum_{j\gt i}[P_j\lt P_i] $$ 然后是特别波特的一步!这个东西对于 ......
ARC 154

ARC 补题笔记 1

## ARC156 ### A. Non-Adjacent Flip >给定长度为 $n\ (3\le n\le 2\times10^5)$ 的 01 串,每次选定 $1\le i,j\le n$ 且 $|i-j|\ge2$,将 $i,j$ 位上的数字 $x$ 变为 $1-x$。求全部数字变为 $1 ......
笔记 ARC

【模板】数论基础:exGCD,exCRT,inverse,Lucas,BSGS,primitive root

# 7.29 数论 WIP $a\equiv b\pmod p\Rightarrow \frac{a}{d}\equiv \frac{b}{d}\pmod{\frac{p}{d}},d=\gcd(a,b,p)$。 ## exGCD 1. 若 $(a,b)=1$,则 $0\leq xb\to a\bm ......
数论 primitive 模板 inverse 基础

AT_arc113_c 题解

[洛谷链接](https://www.luogu.com.cn/problem/AT_arc113_c)&[Atcoder 链接](https://www.luogu.com.cn/remoteJudgeRedirect/atcoder/arc113_c) 本篇题解为此题**较简单做法**及**较少 ......
题解 AT_arc 113 arc AT

Atcoder ARC060D Digit Sum

看到 $n\le 10^{11}$,考虑按根号分为两部分处理。 对于 $b\le \sqrt{n}$,考虑直接暴力算 $\operatorname{f}(b, n)$ 判断是否等于 $s$,这部分的计算量是 $O(\sqrt{n})$ 级别的。 对于 $\sqrt{n} n$,这个时候 $\oper ......
Atcoder Digit 060D ARC 060

[ARC143B] Counting Grids 题解

[Counting Grids](https://www.luogu.com.cn/problem/AT_arc143_b) ### 题目大意 将 $1\sim n^2$ 填入 $n\times n$ 的网格 $A$ 中,对于每个格子满足以下条件之一: - 该列中存在大于它的数。 - 该行中存在小于 ......
题解 Counting Grids 143B ARC

AT_arc041_b 题解

[洛谷链接](https://www.luogu.com.cn/problem/AT_arc041_b)&[Atcoder 链接](https://www.luogu.com.cn/remoteJudgeRedirect/atcoder/arc041_b) 本篇题解为此题较**简单做法**及**较少 ......
题解 AT_arc 041 arc AT

AT_arc149_a 题解

[洛谷链接](https://www.luogu.com.cn/problem/AT_arc149_a)&[Atcoder 链接](https://atcoder.jp/contests/arc149/tasks/arc149_a) 本篇题解为此题较**简单做法**及**较少码量**,并且码风优良, ......
题解 AT_arc 149 arc AT

AT_arc154_b 题解

[洛谷链接](https://www.luogu.com.cn/problem/AT_arc154_b)&[Atcoder 链接](https://www.luogu.com.cn/remoteJudgeRedirect/atcoder/arc154_b) 本篇题解为此题较**简单做法**及**较少 ......
题解 AT_arc 154 arc AT

AT_arc157_a 题解

## 思路 看数据范围时能发现,这 $N$ 啥用也没有,因为 $A+B+C+D=N-1$。 首先,$B$,$D$ 为 $0$ 且 $A$,$C$ 为 $0$ 的情况是不可能有的,因为既然有 `XX` 和 `YY` 字符串,那么一定会至少组成一个 `XY` 或 `YX`,输出 `No`; 然后,$\l ......
题解 AT_arc 157 arc AT

[ARC150F] Constant Sum Subsequence

Problem StatementWe have a sequence of positive integers of length $N^2$, $A=(A_1,\ A_2,\ \dots,\ A_{N^2})$, and a positive integer $S$. For this sequ ......
Subsequence Constant 150F ARC 150

Atcoder ARC058E Iroha and Haiku

题目中的式子转化一下即存在一位 $i$ 使得到 $i$ 时的后缀和存在 $X + Y + Z, Y + Z, Z$,再发现 $X + Y + Z\le 17$,考虑状压。 设 $f_{i, j}$ 为填了 $i$ 个数当前后缀和中存在的数的状态为 $j$(只存 $0\sim X + Y + Z$ 的 ......
Atcoder Iroha Haiku 058E ARC