vis

https://www.luogu.org/problem/P4380

独自空忆成欢 提交于 2019-12-03 01:25:35
题目 第一问: 用广搜类似用 \(floodfill\) 的方法。 第二问: 暴力枚举加剪枝,对于每个连通块,枚举跟这个连通块相连的其他与他颜色不同的连通块,然后向外扩展合并颜色与他们俩相同的连通块。扩展合并颜色的时候需要在以每个连通块为节点的图上广搜,每次都将不在当前双色连通块内连通块且颜色和当前双色其一相同的点加入队列。注意在建图的时候,只连接相邻的颜色 不同 的连通块,然后有每个边只会被扩展一次,因为边一定连接颜色不同的块,如果该边被遍历了,所以其实该边的双色连通块的两个颜色都确定了,也就找过了。而且防止出现多次计算的情况,我们枚举两个颜色连通块时,要满足编号小的不枚举,因为肯定在之间就已经枚举过了。 #include <bits/stdc++.h> using namespace std; int n, maxn1, maxn2, abc, N, id, id2, cnt = 1, ma[256][256], lin[1001000]; int vis1[256][256], vis2[1000010], fa[1010001], sum[1001011], color[1000011];//vis1记录的是每个点的连通块标号,sum记得是每个连通块的大小, color是每个连通块的颜色。 int di[5] = {0, 0, 1, -1}; int dj[5] = {-1

how can I make the uiviewcontroller visible only once during first run of the app (e.g. tutorial)?

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm creating an iOS swift app and I want to show tutorial screen when user runs the app for the very first time. Later on, with each run of the app the tutorial should be hidden and another view controller should be visible as a starting point. So far my storyboard looks like this: It contains two screens of tutorial (1st and last) and tab bar (which is a main window of my app). As for now, in storyboard I chose the tab bar to be an initial view controller: And with that approach the tutorial screen is never seen. How can I show it only once

Pyinstaller adding splash screen or visual feedback during file extraction

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I create a single file python application with Pyinstaller using --onefile parameters. Everything work as expected but the startup time is around 10 seconds on my machine. The problems is that during the file unpacking process of Pyinstaller package there are no visual feedback, so you don't know if the application is starting or even if you really clicked the icon. This problem became worse if the machine is slow (on my test with a very old machine i need almost 20 seconds to see the first login of my application) There is a way

Fortify throws error while scanning Visual Studio project

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to run Fortify on a Visual Studio 2008 project. The project builds successfully on its own. When I try to analyze the project with Fortify using the Visual Studio integrated controls, the project builds successfully but an error message is thrown. Here's the output from Fortify console: Fortify SCA... Running: "-show-runtime-properties" Running: "-b" "ProjectName" "-clean" Error setting VCProject Path. Abort VC project related scan Scan Failed Could not load file or assembly 'Microsoft.VisualStudio.VCProjectEngine, Version=8.0.0.0

How Do I Extract a Full Icon From a Vista/7 Executable?

匿名 (未验证) 提交于 2019-12-03 00:58:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: If I have a Vista .ico file which contains a 16x16, 32x32, 256x256 etc. version of an icon, I can successfully load it as a .NET Icon by simply doing -: Icon myIcon = new Icon("C:\\MyIcon.ico"); I can then access all of the various sized images in the icon. I can even access the 256x256 Vista PNG using methods detailed HERE . However, I haven't found a way to get the full set of icon images from a Vista executable. Unfortunately, doing this -: Icon myIcon = Icon.ExtractAssociatedIcon("C:\\MyExe.exe"); ...only results in a single 32x32 image

Wannafly挑战赛19

匿名 (未验证) 提交于 2019-12-03 00:40:02
A. 队列Q 随便on 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn = 1e5 + 10 ; 4 int q[maxn], f[maxn], b[maxn], vis[maxn]; 5 stack< int > F, B; 6 vector< int > ans; 7 8 int main() { 9 int N, Q; 10 scanf( " %d " , & N); 11 for ( int i = 1 ; i <= N; ++i) scanf( " %d " , q + i); 12 scanf( " %d " , & Q); 13 while (Q-- ) { 14 int x; 15 char s[ 11 ]; 16 scanf( " %s %d " , s, & x); 17 if (s[ 0 ] == ‘ F ‘ ) f[x] = 1 , b[x] = 0 , F.push(x); 18 else f[x] = 0 , b[x] = 1 , B.push(x); 19 } 20 while (! F.empty()) { 21 int x = F.top(); F.pop(); 22 if (!f[x] || vis[x]) continue ; 23 vis[x] = 1 ,

分解强连通分量

匿名 (未验证) 提交于 2019-12-03 00:38:01
模板题目: http://poj.org/problem?id=2553 Kosaraju:按顺序对原图和反图DFS一遍,在第二次DFS时点u可达未DFS的点v则u,v属于同一个联通分量 #include <cstdio> #include <iostream> #include <cstring> #include <queue> #include <map> #include <vector> #include <set> #include <cmath> #include <cstdlib> #include <algorithm> #include <stack> using namespace std ; const int maxn = 5005 ; int out [ maxn ]; int in [ maxn ]; vector <int> G [ maxn ]; vector <int> Gr [ maxn ]; vector <int> rG [ maxn ]; vector <int> P [ maxn ]; vector <int> ps ; int ID [ maxn ]; int n , m ; bool vis [ maxn ]; void DFS ( int u ) { vis [ u ] = true ; for ( int i = 0 ; i <

codeforces 1000F One Occurrence

匿名 (未验证) 提交于 2019-12-03 00:38:01
codeforces 1000F One Occurrence #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for(int i=(a); i<(b); i++) #define sz(a) (int)a.size() #define de(a) cout << #a << " = " << a << endl #define dd(a) cout << #a << " = " << a << " " #define all(a) a.begin(), a.end() #define endl " \ n" typedef long long ll; typedef pair< int , int > pii; typedef vector< int > vi; //--- const int N = 500050 ; int n, m; int a[N], ans[N], nx[N], vis[N]; bool in[N]; vector<pii> q[N]; struct Seg { #define ls (rt<<1) #define rs

全排列

匿名 (未验证) 提交于 2019-12-03 00:38:01
全排列 T ime limit :1000 ms Memory limit :131072 kB Problem Description 给出一个字符串S(可能有重复的字符),按照字典序从小到大,输出S包括的字符组成的所有排列。例如:S = “1312”, 输出为: 1123 1132 1213 1231 1312 1321 2113 2131 2311 3112 3121 3211 Input 输入一个字符串S(S的长度 <= 9,且只包括0 - 9的阿拉伯数字) Output 输出S所包含的字符组成的所有排列 Sample Input 1312 Sample Output 1123 1132 1213 1231 1312 1321 2113 2131 2311 3112 3121 3211 主要就是学会搜索,这个就是利用搜索解决的。具体见代码: #include <stdio.h> #include <string.h> #include <algorithm> using namespace std ; int vis [ 15 ], len ; char a [ 15 ], b [ 15 ]; void dfs ( int l ) { if (!( len - l )) { for ( int i = 0 ; i < l ; i ++) printf ( "%c" , b

Codeforces #477 Div1. E May Holidays

匿名 (未验证) 提交于 2019-12-03 00:37:01
给出 N N 个节点的一棵树,每个节点有开和关两种状态,且每个点有权为 t i t i ,给出 M M 个操作,每次改变一个节点的状态(给出负数则关,正数则开),求每次操作过后,有多少个节点满足,自己处于开状态,且子树内处于关状态的节点数严格大于该节点的 t t . N , M < = 100000 N , M <= 100000 时限五秒 Analysis 考虑到每次修改,只会影响到其到根节点的节点对答案的贡献,每一次操作可以看成对一个节点的 t i t i 加减,求的是有多少个节点的 t i < 0 t i < 0 。这个东西用数据结构及其难维护。再分析一下,每一次操作影响到的点仅是一部分点,很多点的贡献未变。那么是否可以一次计算多次操作的答案。我们可以把操作分块,每 M √ M 个操作放到一起做。具体做法是:考虑修改的节点提出来,建成虚树,那么虚树上每个儿子到父亲的边上的原树的点,对于一次影响它们的操作,他们的变化量是相同的。那么可以把它们拉出来排个序,去重,每条边维护一个指针,指向它们的零分界线,就可以算出答案(注意点的开关状态),修改点的答案要单独算。复杂度约为 O ( N N √ ) O ( N N ) ,常数比较大,排序的时候用基数排序才能达到准确的复杂度,由于偷懒,用了快排。 # include<cstdio> # include<cstring> #