摘要:
#include<bits/stdc++.h> #pragma GCC optimize(2) #define ll long long using namespace std; ll n,m;ll a[1000001];ll tree[1000001];ll tag[1000001]; int t 阅读全文
摘要:
吊坠 import os import sys from collections import defaultdict # 请在此输入您的代码 n,m=map(int,input().split()) l=[] cnt=0 for i in range(n): a=input() a=a+a d=d 阅读全文
摘要:
洛谷单调队列模板 n,k=map(int,input().split()) l=list(map(int,input().split())) def sld(m,k): max_r=[] max_q=[] min_r=[] min_q=[] for i,num in enumerate(m): wh 阅读全文
摘要:
作为一个城市的应急救援队伍的负责人,你有一张特殊的全国地图。在地图上显示有多个分散的城市和一些连接城市的快速道路。每个城市的救援队数量和每一条连接两个城市的快速道路长度都标在地图上。当其他城市有紧急求助电话给你的时候,你的任务是带领你的救援队尽快赶往事发地,同时,一路上召集尽可能多的救援队。 输入格 阅读全文
摘要:
区别在于图的可达性。如果由任意节点出发(以任意节点为根)可以到达所有节点, 那么遍历就只需要跑一次dfs;若可达性无法保证,则需要多次运行dfs; #include<bits/stdc++.h> using namespace std; #define N 10001 int m,n; int vt 阅读全文
摘要:
#include<bits/stdc++.h> using namespace std; #define N 10001 int m,n,t; int dp[N]; vector<pair<int,int>>v[N]; int main() { cin>>m>>n; int a,b,x; for(i 阅读全文
摘要:
样题通往奥格瑞玛的道路 #include<bits/stdc++.h> using namespace std; const int N=10001; long long f[N]; vector<pair<int,long long>>vec[N]; priority_queue<pair<lon 阅读全文
摘要:
图有最小生成树的充要条件:图是可达的 常见表述:从某节点出发可到达其余节点 #include<bits/stdc++.h> using namespace std; struct edge { int a,b,w; bool operator<(edge &other) { return w<oth 阅读全文
摘要:
题目传送门 #include<bits/stdc++.h> using namespace std; #define max(a,b) a>b?a:b #define min(a,b) a>b?b:a int n;int a[1001];int g[1001][1001]; int main() { 阅读全文
摘要:
入门题目: 最大子树和、女仆咖啡厅桌游吧 #include<bits/stdc++.h> using namespace std; int f[16001];int cnt[16001];int a[16001]; vector<int>e[16001];int n;int mx=-10000000 阅读全文