ICode9

精准搜索请尝试: 精确搜索
  • AtCoder Beginner Contest 258 A - E2022-07-03 17:34:15

    传送门 这场打的有一种我又行了的感觉 A - When? 向下取整 + 取余 #include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <string> #include <queue> #include <functional> #include <map> #include <set>

  • AtCoder Beginner Contest 258 G - Triangle2022-07-03 13:31:23

    O(M*sqrt(M))的做法超时 考虑直接暴力,用bitset实现小常数,时间复杂度O(N^3 / 64) #include<bits/stdc++.h> using namespace std; #define fr first #define se second #define et0 exit(0); #define rep(i,a,b) for(int i=a;i<=b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i

  • AtCoder Beginner Contest 257 A - F2022-07-02 15:33:34

    传送门 vp 了一场之前的 ABC,不知道是水平下降还是真的难,就很多要想很久,寄了 A - A to Z String 2 向下取整考虑一下是在哪个组就好 #include <iostream> using namespace std; int main() { int n, x; cin >> n >> x; x--; x /= n; cout << (char)('A' + x)

  • Atcoder-ABC159-EF 题解2022-06-29 11:33:38

    Atcoder题解汇总 ABC 159 E. Dividing Chocolate (二进制枚举,观察数据范围) 题意 有 \(H\times W\) 大小的方格矩阵,每个方格为 \(0\) or \(1\), 现在可以进行横切与竖切,询问最少切多少次可以保证最后的分块中每个分块都有不超过 \(K\) 个 \(1\)。 数据范围 \(1\leq H \leq 10\) \(

  • atcoder regular contest 1142022-06-28 16:01:02

    做了四个题,ABCE。BC比较简单就不说了。主要说一下ADEF。 A - Not coprime 题目叙述 给 \(n\) 个数,要找出最小数使得每个数都和这个数不互质。 数的大小 \(\le 50\)。 题解 一开始想网络流什么的去了。 实际上直接 \(2^{c}\)(其中 \(c\) 为 \(\le 50\) 的质数个数),枚举质数集合就可以

  • Atcoder Beginner Contest 2572022-06-26 10:00:07

    A - A to Z String 2 代码: void solve(int Case) { int n; string s = " "; cin >> n; int k; cin >> k; for (int i = 'A'; i <= 'Z'; i++) { for (int j = 1; j <= n; j++) {

  • AtCoder Beginner Contest 2572022-06-26 02:33:05

    咕咕咕咕咕。 F - Teleporter Setting 题意 给一个有\(n\)个节点\(m\)条边的无向图,边集中有一部分边只确定了一端,记这部分边的集合为\(S\)。 对于\(i = 1, 2, \dots, n\),问当\(S\)中的边的不确定的那一端均为\(i\)时,从点\(1\)到点\(n\)的最短路长度。 其中,\(2 \le n \le 3 \times

  • AtCoder Beginner Contest 2562022-06-25 13:31:59

    A - 2^N 签到 #include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << ( 1 << n ) << endl; } B - Batters 按照要求模拟一下 n = int(input()) a = list(map(int, input().split())) now = [ 0 , 0 , 0, 0

  • Atcoder-ABC158-EF 题解2022-06-25 02:31:16

    Atcoder题解汇总 ABC 158 E. Divisible Substring (取模前缀和思维, 一点点基本数论) 题意 给了一个长度为 \(n\) 的数字串,和一个质数 \(p\) ,询问有多少子串对应的数字满足是 \(p\) 的倍数,输出答案, 若有前导零也算作合法数字。 数据范围 \(1\leq N \leq 2 * 10^5\) \(2\leq P \le

  • 【Atcoder F - Cumulative Cumulative Cumulative Sum】线段树2022-06-24 11:00:45

    要特别注意下精度,long,int范围。WA了几次   import java.util.Scanner; class Main { // static long[] A2 ;//i^2*AI // static long[] A1;//i*Ai; static long[] A; //Ai; static long[] f2; static long[] f1; static long[] f0; static long p

  • AtCoder 题解集合2022-06-24 02:31:21

    目录AGCARCABCABC 150D. Semi Common Multiple (LCM, 数学推导)E. Change a Little Bit (组合计数推导)F. Xor Shift (XOR差分性 + KMP)ABC 151E. Max-Min Sums (组合计数, 贡献, 排序)F. Enclose All (待补, 最小圆覆盖)ABC 152D. Handstand 2 (思维暴力模拟)E. Flatten (质因子

  • AtCoder Beginner Contest 256(补题)2022-06-22 19:31:58

    E - Takahashi's Anguish 题意: 现有\(N\)个人,现在需要你决定你个排列,第\(i\)个人讨厌第\(X_i\)个人,所以若第\(X_i\)个人排在第\(i\)个人前面的话,则会产生\(C_i\)的厌倦值,现在让你输出最小的厌倦值总和 思路: \(n\)个人,每个人\(i\)都向\(X_i\)连一条有向边,\(n\)个人\(n\)条边,所以若

  • [题解] Atcoder ARC 142 D Deterministic Placing 结论,DP2022-06-21 22:00:57

    题目 (可能有点长,但是请耐心看完,个人认为比官方题解好懂:P) 首先需要注意,对于任意节点i上的一个棋子,如果在一种走法中它走到了节点j,另一种走法中它走到了节点k,那么这两种走法进行完后,棋子占据的节点集合不可能相同,因为在这两种走法中,节点i必有两个子树中的棋子数量不同。所以,题目

  • [题解] Atcoder ARC 142 E Pairing Wizards 最小割2022-06-20 18:32:35

    题目 建图很妙,不会。 考虑每一对要求合法的巫师(x,y),他们两个的\(a\)必须都大于\(min(b_x,b_y)\)。所以在输入的时候,如果\(a_x\)或者\(a_y\)小于\(min(b_x,b_y)\),可以先把\(a_x\)和\(a_y\)提升到\(min(b_x,b_y)\)(以后的a数组都指做过这步操作的)。接下来如果\(max(a_x,a_y)\geq

  • AtCoder-abc255_e Lucky Numbers2022-06-13 09:32:46

    Lucky Numbers 思维题 不难看出,如果我们固定了数组 \(A\) 的一个值,那么数组 \(A\) 的其他值都可以通过数组 \(S\) 算出来,所以我们可以通过一个位置的值来表示一整个数组 \(A\),这样的话就可以枚举所有位置上的最佳值,判断他是属于哪个数组的,然后这个数组的值 + 1,最后选取最大值即可

  • AtCoder-abc255_d ±1 Operation 22022-06-13 09:31:49

    ±1 Operation 2 离线 + 尺取 或者 直接二分 二分更简单 二分一下当前询问的数 \(X\) 的位置 \(index\),左边(小于等于当前数)的每一个数字的贡献都为 \(X - A_i\),右边(大于当前数)的每一个数字的贡献都为 \(A_i - X\),因此考虑求和的时候用前缀和优化一下就好 #include <iostream> #inc

  • Aising Programming Contest 2022(AtCoder Beginner Contest 255)2022-06-12 13:36:42

    Aising Programming Contest 2022(AtCoder Beginner Contest 255) E 题意 给一个数组 \(S\) 满足 \(S_i = a_i + a_{i + 1}\) ,\(0 < i < n\) 。给一个好数集合 \(X\) 要求用 \(S\) 构造出来的数组 \(a\) 中含最多的好数。 思路 当确定 \(a\) 中任意一个元素整个数组就确定了。最暴力

  • atcoder beginner contest 2552022-06-12 12:01:23

    A - You should output ARC, though this is ABC. 代码: #include <bits/stdc++.h> #define int long long int _ = 0, Case = 1; using namespace std; #define all(v) begin(v),end(v) #define nline '\n' int a[3][3]; void solve(int Case) { int x,

  • Aising Programming Contest 2022(AtCoder Beginner Contest 255)2022-06-12 01:02:35

    ABC比较简单,DF过于经典。 E - Lucky Numbers 题意 给定一个长度为\(n - 1\)的数组\(s\),和长度为\(m\)的数组\(t\)。 要求构造出一个满足\(\forall i \in [1, n - 1], a_i + a_{i + 1} = s_i\)的数组\(a\),并且最大化满足\(a_i \in \{t_i | 1 \le i \le m\}\)的\(i\)的数量。 思

  • AtCoder Beginner Contest 2542022-06-05 02:33:27

    A和B跳过。 C - K Swap 题意 给定长度为\(n\)的数组\(a\),每次可以从\([1, n - k]\)中选择一个\(i\)然后交换\(a_i\)和\(a_{i + k}\),问是否能通过有限次的操作将\(a\)升序排序。 其中\(2 \le n \le 2 \times {10}^5\)。 思路 操作可以看成:模\(k\)同余的位置上的元素两两间可以交

  • AtCoder 题目乱做2022-05-31 12:31:37

    NOMURA Programming Contest 2022(AtCoder Beginner Contest 253) A - Median? 无脑比大小即可。 Code namespace LZX { using namespace std; int _main() { int a,b,c; scanf("%d%d%d",&a,&b,&c); if((a<=b&&am

  • AtCoder Regular Contest 141 - B - Increasing Prefix XOR2022-05-30 18:36:11

    原文 Consider the problem in binary. If positive integers \(a\) and \(b\) have the same number of digits, the only case when both \(a<c\) and \(b < b\oplus c\) hold is when \(c\) has more digits than each of \(a\) and \(b\), in which ca

  • AtCoder Regular Contest 141 A - Periodic Number2022-05-30 00:31:28

    搜刮来的测试数据: 1001 102938102922382938 2222222 12321 142857142856 99898 #include<bits/stdc++.h> using namespace std; typedef pair<string,int> PSI; bool cmp(PSI x,PSI y){ return stol(x.first)>stol(y.first); } int main(){ int T; cin>>

  • AtCoder Beginner Contest 253 A - E2022-05-29 13:31:07

    传送门 A - Median? 找中间数 #include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <string> #include <queue> #include <functional> #include <map> #include <set> #include <cma

  • AtCoder Beginner Contest 253 F - Operations on a Matrix // 树状数组2022-05-29 12:00:49

    题目传送门:F - Operations on a Matrix (atcoder.jp)   题意: 给一个N*M大小的零矩阵,以及Q次操作。操作1(l,r,x):对于 [l,r] 区间内的每列都加上x;操作2(i,x):对于第 i 行,替换为x;操作3(i,j):查询矩阵第 i 行,第 j 列元素的值。 N、M、Q大小均为2E5.   思路:树状数组 首先考虑没有操作2的情况,那么很

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有