ICode9

精准搜索请尝试: 精确搜索
  • CF1093G Multidimensional Queries2022-07-14 22:33:39

    \(\text{Code}\) 分析在 2022暑假集训 #include <cstdio> #include <iostream> #define IN inline using namespace std; const int N = 2e5 + 5, INF = 0x3f3f3f3f; int n, d, a[N][5]; IN void read(int &x) { x = 0; char ch = getchar(); int f = 1; for(

  • [LeetCode] 1310. XOR Queries of a Subarray 子数组异或查询2022-07-08 21:32:06

    You are given an array arr of positive integers. You are also given the array queries where queries[i] = [lefti, righti]. For each query i compute the XOR of elements from lefti to righti (that is, arr[lefti] XOR arr[lefti + 1] XOR ... XOR ar

  • Leetcode 1170. 比较字符串最小字母出现频次(可以,已解决)2022-06-26 11:05:28

    定义一个函数 f(s),统计 s 中(按字典序比较)最小字母的出现频次 ,其中 s 是一个非空字符串。 例如,若 s = "dcce",那么 f(s) = 2,因为字典序最小字母是 "c",它出现了 2 次。 现在,给你两个字符串数组待查表 queries 和词汇表 words 。对于每次查询 queries[i] ,需统计 words 中满足 f(quer

  • 1182. 与目标颜色间的最短距离(二分查找)2022-05-09 00:35:04

    1182. 与目标颜色间的最短距离 给你一个数组 colors,里面有  1、2、 3 三种颜色。 我们需要在 colors 上进行一些查询操作 queries,其中每个待查项都由两个整数 i 和 c 组成。 现在请你帮忙设计一个算法,查找从索引 i 到具有目标颜色 c 的元素之间的最短距离。 如

  • Cypher Fundamentals-Filtering Queries2022-05-05 00:01:32

    Cypher Fundamentals Reading Data from Neo4j Introduction to Cypher Retrieving Nodes Finding Relationships Traversing Relationships Finding Emil Filtering Queries Finding Specific Actors Writing Data to Neo4j Creating Nodes Creating a Node Creating

  • F. MEX Queries - 线段树 + 离散化2022-05-03 12:35:21

    F. MEX Queries 题意 1 l r 将区间l r 置 1 2 l r 将区间l r 置 0 3 l r 翻转区间l r(即 是1置0 是0置1) 求每次操作后值是0的最左位置编号 思路 用线段树维护 区间和 用一个lazy 标记当前结点 置1 置0 翻转 或者 无需操作(用于减少时间复杂度) 对于翻转操作 每次更新一个结点的lazy要

  • 399. 除法求值(并查集)2022-04-29 22:04:31

    399. 除法求值 给你一个变量对数组 equations 和一个实数值数组 values 作为已知条件,其中 equations[i] = [Ai, Bi] 和 values[i] 共同表示等式 Ai / Bi = values[i] 。每个 Ai 或 Bi 是一个表示单个变量的字符串。 另有一些以数组 queries 表示的问题,其中 

  • Distance Queries2022-04-20 18:31:54

    题目链接:http://poj.org/problem?id=1986 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 const int maxn=40010; 6 int n, m, k; 7 struct edge{ 8 int to, next, weight; 9 }e[maxn<<1]; 10

  • [LeetCode] 1851. Minimum Interval to Include Each Query2022-03-30 01:00:59

    You are given a 2D integer array intervals, where intervals[i] = [lefti, righti] describes the ith interval starting at lefti and ending at righti (inclusive). The size of an interval is defined as the number of integers it contains, or more formal

  • CF710F String Set Queries2022-03-19 13:35:53

    题面传送门 完全颠覆了我对于二进制分组的认知,本来以为那东西只能优化多重背包还被单调队列吊起来打来着。 首先这个题如果不强制在线可以发现就是个AC自动机sb题。 但是问题是它强制在线了,就有一些奇技淫巧来做。 首先显然可以对询问分块,但是有一个26的常数的根号显然跑不过去。

  • 1001. 网格照明_2022_02_082022-02-08 22:32:22

    1001. 网格照明 在大小为 n x n 的网格 grid 上,每个单元格都有一盏灯,最初灯都处于 关闭 状态。 给你一个由灯的位置组成的二维数组 lamps ,其中 lamps[i] = [row<sub style="display: inline;">i</sub>, col<sub style="display: inline;">i</sub>] 表示 打开 位于 grid[row<sub s

  • leetcode1001.网格照明2022-02-08 14:05:18

    题目: 在大小为 n x n 的网格 grid 上,每个单元格都有一盏灯,最初灯都处于 关闭 状态。 给你一个由灯的位置组成的二维数组 lamps ,其中 lamps[i] = [rowi, coli] 表示 打开 位于 grid[rowi][coli] 的灯。即便同一盏灯可能在 lamps 中多次列出,不会影响这盏灯处于 打开 状态。 当

  • 专题二树形结构 E - Can you answer these queries V2022-02-06 23:32:10

    题目 You are given a sequence A[1], A[2], ..., A[N] . ( |A[i]| <= 10000 , 1 <= N <= 10000 ). A query is defined as follows: Query(x1,y1,x2,y2) = Max { A[i]+A[i+1]+...+A[j] ; x1 <= i <= y1 , x2 <= j <= y2 and x1 <= x2 , y1 <= y2 }

  • 每日一题-92(净现值查询)2022-02-03 09:03:59

    题92: 根据下面两表写一个 SQL, 找到 Queries 表中每一次查询的净现值。 其中: NPV表:id, year 是该表主键,该表有每一笔存货的年份, id 和对应净现值的信息;Queries表:id, year 是该表主键,该表有每一次查询所对应存货的 id 和年份的信息。 解题思路:此题需要注意的是Queries 表中

  • Can you answer these queries 1?2022-01-30 16:33:00

    Can you answer these queries 1? 代码 #include<iostream> #include<algorithm> #include<cstdio> using namespace std; const int M = 1e5 + 5; int m, n, len, a[M]; int lg[M << 2], pos[M], p[21][M], s[21][M]; #define max(a,b) ((a) > (b)

  • 图 floyd2022-01-28 13:31:47

    399. Evaluate Division Medium You are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] and values[i] represent the equation Ai / Bi = values[i]. Each Ai or Bi is a string that re

  • 【树形结构】训练题A - Can you answer these queries I2022-01-25 23:04:24

    题意 就是要求一个区间的连续的最大字段和 思路 线段树,注意用结构体建树来的会更方便一些 代码 #include<iostream> #include<cmath> #include<stack> #include<map> #include<queue> #include<cstdio> #include<vector> #include<cstring> #include<algorithm>

  • [POI2007]ZAP-Queries2022-01-17 14:04:23

    洛谷题面 题目大意 给定 \(a,b,d\),求 \[\sum\limits_{i=1}^a\sum\limits_{j=1}^b[\gcd(i,j)=d] \]题目分析 令 \(a\le b\)。 显然先把 \(d\) 消掉(令 \(a'=\left\lfloor\dfrac{a}{d}\right\rfloor,b'=\left\lfloor\dfrac{b}{d}\right\rfloor\)): \[\sum\limit

  • LeetCode399 除法求值2022-01-16 20:01:54

    题目 给你一个变量对数组 equations 和一个实数值数组 values 作为已知条件,其中 equations[i] = [Ai, Bi] 和 values[i] 共同表示等式 Ai / Bi = values[i] 。每个 Ai 或 Bi 是一个表示单个变量的字符串。 另有一些以数组 queries 表示的问题,其中 queries[j] = [Cj, Dj] 表示第 j

  • [分块] Codeforces 1619H Permutation and Queries2022-01-09 13:33:59

    题目大意 给你一个 \(n(1\leq n\leq 10^5)\) 个数的排列 \(p\),你需要维护以下两种操作: 1 x y :交换 \(p_x\) 和 \(p_y\)。 2 i k :令 \(i:=p_i\),\(k\)次后输出\(i\) 。 操作数量小于等于 \(10^5\)。 题解 首先老套路对于排列 \(p\),从 \(i\) 向 \(p_i\) 连边,可以形成若干个有向环。

  • 第四章 索引及执行计划2022-01-03 10:00:37

    1、索引的作用 类似于一本书中的目录,起到优化查询的作用 2、索引的分类(算法) B树 默认使用的索引类型 R树 Hash FullText 全文索引 类似 “ES” GIS 索引 地理位置索引 类似“MongoDB” 3、BTREE索引算法演变(了解) 4、Btree索引功能上的分类 4.1 辅助索引构建过程 (1)

  • 课程表IV——leetcode14622021-12-28 13:33:10

    课程表IV 题目:课程表 IV 你总共需要上 n 门课,课程编号依次为 0 到 n-1 。 prerequisites数对[1,0]表示1是0的先修课程。 对于每个查询对 queries[i] ,请判断 queries[i][0] 是否是 queries[i][1] 的先修课程。 请返回一个布尔值列表,列表中每个元素依次分别对应 queries 每个查询

  • LeetCode-399. 除法求值2021-12-28 11:02:21

    题目来源 399. 除法求值 题目详情 给你一个变量对数组 equations 和一个实数值数组 values 作为已知条件,其中 equations[i] = [Ai, Bi] 和 values[i] 共同表示等式 Ai / Bi = values[i] 。每个 Ai 或 Bi 是一个表示单个变量的字符串。 另有一些以数组 queries 表示的问题,其中 quer

  • CodeForces - 245H Queries for Number of Palindromes2021-12-27 20:35:26

    题意:给定一个字符串,求区间[l,r]内有多少回文子串。 解:回文杀我。区间dp++ 首先这玩意不能像前缀和一样[l,r]=[1,r]-[1,l-1]。 那就直接设dp[i][j]为[i,j]中回文子串的数量。 考虑拿小的拼大的。如果两端不等, dp[i][j]=dp[i+1][j]+dp[i][j-1]-dp[i+1][j-1]; 如果相等在此基础上加一

  • CodeQL 入门- 环境建置2021-12-22 14:31:31

    CodeQL 是一套Github 在2019 开源且免费的静态扫描代码工具,让你能在产品release 前及早发现潜藏的漏洞并提供相对应改善的方法。 CodeQL 有几项显著的特色 : 免费且开源客制化rule/engine可以像查询资料库一样,通过代码编写query 把文件捞出来 CodeQL 常被拿来跟业界主流的Fo

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

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

ICode9版权所有