vis

Codeforces Round #597 (Div. 2)

最后都变了- 提交于 2019-12-03 06:35:15
B. Restricted RPS 贪心,下标i j要分清楚。。。 #include<bits/stdc++.h> using namespace std; #define int long long #define sc(x) scanf("%I64d",&x); #define si signed #define fi first #define se second #define pb push_back #define forn for(int i=0;i<n;i++) char s[105]; int A[3],B[3]; char t[105]; si main() { int T,a,b,c,n; sc(T); while(T--) { sc(n) sc(B[2])sc(B[0])sc(B[1]) scanf("%s",s); A[0]=A[1]=A[2]=0; for(int i=0; i<n; i++) { if(s[i]=='R')A[0]++; else if(s[i]=='P')A[1]++; else if(s[i]=='S')A[2]++; } int ans=0; for(int i=0; i<3; i++) { ans+=min(A[i],B[i]); } // cout<<ans<<'\n'; if(ans*2<n) { puts("NO"); }

缩点

独自空忆成欢 提交于 2019-12-03 06:31:38
老师讲图论-缩点-复习 我想 我没学过 缩点啊 \(OTL\) 先讲 割点 定义 在无向连通图中,如果将其中一个点以及所有连接该点的边去掉,图就不再连通,那么这个点就叫做割点 P3388 【模板】割点(割顶) 主要思想 观察 \(DFS\) 搜索树,我们可以发现有两类节点可以成为割点: 对根节点 \(u\) ,若其有两棵或两棵以上的子树,则该根结点u为割点; 对非叶子节点 \(u\) (非根节点),若其中的某棵子树的节点均没有指向u的祖先节点的回边,说明删除u之后,根结点与该棵子树的节点不再连通;则节点u为割点。 我们用 \(dfn[u]\) 记录节点u在DFS过程中被遍历到的次序号, \(low[u]\) 记录节点 \(u\) 或 \(u\) 的子树通过非父子边追溯到最早的祖先节点(即 \(DFS\) 次序号最小),那么 \(low[u]\) 的计算过程如下: #include <cstdio> #include <vector> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define reg register int #define isdigit(x) ('0' <= (x)&&(x) <= '9') template<typename T> inline

hdu 4612 缩点 桥 树的直径

Deadly 提交于 2019-12-03 03:01:54
// http://acm.hdu.edu.cn/showproblem.php?pid=4612 // 大致题意: 给n个点和m条边,组成一个无向连通图,问 给我 加一条边 的权力 (可连接任意两点)->让图的桥数量最小,输出此时桥的数量。(2<=N<=200000, 1<=M<=1000000) // 无向环里面的边没有桥,缩点,因为是连通图,所以缩完点后构成了一棵树,每条树边都是一个桥。要加一条边使得加完后图的桥数最小,结合上述,所以选择连接树直径的两端点。ans = 原先桥数 - 树的直径 树的直径两种写法:(参考 博客😁 and 证明 树形dp 和 两次dfs(贪心思想) dp :(代码短 但不能记录路径) 1 void dp(int cur) 2 { 3 vis[cur] = true; //当前结点已访问 4 for(int i = head[cur]; i != -1; i = edge[i].nxt){ 5 int v = edge[i].v; 6 if(vis[v]) continue; //不走回头路 7 dp(v); 8 ans_max = max(ans_max, d[cur] + d[v] + edge[i].w); //更新树的直径(由当前结点两段之和更新) 9 d[cur] = max(d[cur], d[v]+edge[i].w); /

Error: A newer version of Microsoft Visual C++ 2010 Redistributable has been detected on the machine

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When I try to run the VS 2010 redistributable "vcredist_x86.exe", an error "A newer version of Microsoft Visual C++ 2010 Redistributable has been detected on the machine" occurs and blocks me from installation. I have actually installed VS 2010 pro on my computer. But I actually have no idea what an VS 2010 redistributable means and why the error occurred. Can anyone help to explain or solve the problem? Thank you very much in advance. 回答1: Redistributable packages are only required on machines that don't have VS2010 installed to provide the

How to disable Perfwatson2.exe from Visual Studio 2017

匿名 (未验证) 提交于 2019-12-03 02:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How do I disable Perfwatson in VS 2017? Perfwatson is not disabled by Tools > Extensions and Updates > Developer Analytics Tools . 回答1: From the help menu, select Send Feedback > Settings . In the Visual Studio Experience Improvement Program dialog, select No, I would not like to participate. 文章来源: How to disable Perfwatson2.exe from Visual Studio 2017

Why am I not able to build Vim with Visual Studio 2015 RC command line tools?

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Yesterday, I installed Visual Studio 2015 RC Community Edition . As a first test, I tried building GVim from source. I opened a command window using "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2015\Visual Studio Tools\Windows Desktop Command Prompts\VS2015 x64 Native Tools Command Prompt.lnk" , set set include=%include%;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include so Make_mvc.mak picks up the Win32.mak file. Also, I set: set MSVCVER=12.0 as the make file does not detect the new Visual Studio version at

「NOIP2013」华容道

狂风中的少年 提交于 2019-12-03 02:28:13
传送门 Luogu 解题思路 预支一点东西: 这题其实有着更为思维的图模型,还十分考验码力,不简单啊 这居然是联赛题 讲正解: 显然我们对于一种合法方案,空格子肯定是一直围绕着特定棋子反复横跳的。 所以说我们可以先预处理一下:对于任何一种合法的情况,求出空格在指定棋子的四个方向横跳的最小步数,这个可以通过多次 \(\text{BFS}\) 来求。 然后考虑处理询问。 不难想到任何一种走法都是先让空格来到指定棋子旁,然后进行上面提到的反复横跳,最后空格也一定会与指定棋子相邻。 所以说,我们就对于每一种指定棋子和空格的摆放情况创建一个节点,通过空格的横跳和指定棋子和空格的交换,也就是摆放情况的变化来连边。 每次询问时,我们先让空格来到指定棋子旁(这个需要枚举四个不同方向,当然要合法), 然后多源最短路,最后枚举一下终止状况,取最小步数的方案作为答案就好了。 说是这么说,其实码起来细节多得不得了啊。。。 细节注意事项 爆搜题,你们懂得。。。 参考代码 #include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include <cctype> #include <cmath> #include <ctime> #include <queue>

java.lang.ClassNotFoundException: it.geosolutions.jaiext.range.Range

匿名 (未验证) 提交于 2019-12-03 01:46:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I recently started my first program with GeoTools in which i was also using JAI- Java Advanced Imaging. I found following error Exception in thread "main" java.lang.NoClassDefFoundError: it/geosolutions/jaiext/range/Range at it.geosolutions.jaiext.crop.CropDescriptor.(CropDescriptor.java:62) at it.geosolutions.jaiext.crop.CropSpi.updateRegistry(CropSpi.java:56) at javax.media.jai.OperationRegistry.registerServices(OperationRegistry.java:2056) at javax.media.jai.ThreadSafeOperationRegistry.registerServices(ThreadSafeOperationRegistry.java:620

Prolog findall infinite loop

匿名 (未验证) 提交于 2019-12-03 01:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a predicate that asserts things. When I use a findall it goes into an infinite loop. assertarv([N|R]):- assert(veiculos_troncos(N)), assertarv(R). assertarv([]). When I use findall(A,veiculos_troncos(A),NTr) , after having used the above predicate to assert many points (coordenates). This is what I get(using findall): Exit: (22) veiculos_troncos((-7, 6)) ? creep Redo: (22) veiculos_troncos(_G6719) ? creep Exit: (22) veiculos_troncos((-6, 6)) ? creep Redo: (22) veiculos_troncos(_G6719) ? creep Exit: (22) veiculos_troncos((-4, 4)) ?

MSBuild support for T4 templates in Visual Studio 2017 RTM

匿名 (未验证) 提交于 2019-12-03 01:27:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In Visual Studio 2015, I'm using the NuGet package Unofficial.Microsoft.VisualStudio.TextTemplating.14.0.0 which allows me to transform T4 templates directly from MSBuild, whenever a project is built. In Visual Studio 2017 RTM however, this breaks the build with the following messages: An Exception was thrown while running the transformation code. The process cannot continue. The following Exception was thrown: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral,