05 2020 档案
摘要:link 题解: 按高度升序排序,若高度相同,按宽度降序排序。到i后,用线段树找w,d 在[0,0]-[wi-1,di-1]的最大值,更新此节点。 class Solution { public: unordered_map<int,int> seg[3010<<2]; int qx1,qy1,qx
阅读全文
摘要:trylock: #include <stdio.h> #include <unistd.h> #include <pthread.h> int beginnum=1000; pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER; void* thr_
阅读全文
摘要:link 解法: 模拟双端队列。刚开始的N*M个客户一次排队到窗口,并计算一下他们完成服务的时间点。对于每一个后面的人,看哪儿一个窗口最早有人出队,则排在次队,根据队尾的人计算一下此人的结束时间。 最后判断如果一个人的开始服务时间>=17:00,则sorry。 #include <bits/stdc
阅读全文
摘要:#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> #include <stdlib.h> #includ
阅读全文
摘要:link 题解: 参考 https://www.luogu.com.cn/blog/12cow/SBCOI2020 从i到i-1,dp[k+1][j]与dp[i][k]交点左移,deque后端pop,需要多考虑i-1这个点,比较后加到deque前端。 #include <bits/stdc++.h>
阅读全文
摘要:link #include <bits/stdc++.h> # define LL long long using namespace std; struct Edge{ int to; int next; }e1[500010], e2[500010]; int head1[100010]; in
阅读全文
摘要:link class Solution { public: int maxSubarraySumCircular(vector<int>& A) { int maxsum=INT_MIN; int minsum=INT_MAX; int total=0; int curmax=0; int curm
阅读全文
摘要:link #include <iostream> #include <string> #include <vector> #include <algorithm> #include <climits> #include <cmath> using namespace std; int N, K, M
阅读全文
摘要:link a b 相等等价于 a^b=0. 则问题转换为找一对i,j a[i]^...^a[j]=0. class Solution { public: int countTriplets(vector<int>& arr) { int n=arr.size(); vector<int> pre(n
阅读全文
摘要:link class Solution { public: long mod = 100000000000007L; long head=1L; int distinctEchoSubstrings(string text) { int n=text.size(); unordered_set<lo
阅读全文
摘要:link Fenwick Tree: class Solution { public: int n; int reversePairs(vector<int>& nums) { n=nums.size(); vector<int> copy=nums; sort(copy.begin(),copy.
阅读全文
摘要:link int getint(){ int res=0; char c=getchar(); while(!(c>='0' && c<='9')) c=getchar(); while(c>='0' && c<='9'){ res=res*10+(c-'0'); c=getchar(); } re
阅读全文
摘要:link int dis[500][500]; int cost[500][500]; int pre[500]; int mindis[500]; int mincost[500]; int inque[500]; int main(){ memset(dis,-1,sizeof(dis)); i
阅读全文
摘要:link /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NUL
阅读全文
摘要:link class Solution { public: struct Comp{ bool operator()(vector<int>& v1, vector<int>& v2){ return v1[0]+v1[1]>v2[0]+v2[1]; } }; int kthSmallest(vec
阅读全文
摘要:link class Solution { public: int longestSubarray(vector<int>& nums, int limit) { int n=nums.size(); deque<int> maxdq; deque<int> mindq; int right=0;
阅读全文
摘要:https://www.jvruo.com/archives/215/ https://www.renfei.org/blog/bipartite-matching.html
阅读全文
摘要:link # Write your MySQL query statement below select t3.product_id,p.product_name,year as report_year,amount as total_amount from ( select product_id,
阅读全文

浙公网安备 33010602011771号