摘要:
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 class Solution { public: int longestSubarray(vector<int>& nums, int limit) { int n=nums.size(); deque<int> maxdq; deque<int> mindq; int right=0; 阅读全文