File size: 4,915 Bytes
7ab4270
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
code`block`FunctionDecl`FunctionDeclRec`ForStmt`ForStmtRec`DoStmt`DoStmtRec`WhileStmt`WhileStmtRec`IfStmt`IfStmtRec`SwitchStmt`SwitchStmtRec`countBlocks`countBlocksRec`countCondition`countVariable`countLiteral`IntegerLiteral`StringLiteral`IfStmt`ForStmt`WhileStmt`DoStmt`SwitchStmt`countLoop`VarDecl`DeclRefExpr`DeclStmt`countDecl`countPointer`writeFunction`CallExpr`BinaryOperator`UnaryOperator`CompoundAssignOperator`countOperand`ArraySubscriptE`RealFaultLocation
int find(int x)`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0
	int r = x;`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`0`0`0`0`0`0`0`0`0`1`1`1`3`0`0`0`0`0`0`0`0`0
	while(r != pre[r])`FunctionDecl,false;WhileStmt,false;`1`0`0`0`0`0`1`0`0`0`0`0`2`0`1`3`0`0`0`0`0`1`0`0`1`0`3`0`3`0`0`0`1`0`0`1`1`0
		r = pre[r];`FunctionDecl,false;WhileStmt,false;`1`0`0`0`0`0`1`0`0`0`0`0`2`0`1`3`0`0`0`0`0`0`0`0`0`0`3`0`3`0`0`0`1`0`0`1`1`0
	pre[x] = r;`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`3`0`0`0`0`0`0`0`0`0`0`3`0`3`0`0`0`1`0`0`1`1`0
	return r;`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`0`0`0`0`0`0`0`0`0`0`1`0`1`0`0`0`0`0`0`0`0`0
void mix(int x, int y)`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0
	int a1 = find(x),a2 = find(y);`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`2`0`0`0`0`0`0`0`0`0`2`4`1`7`0`2`2`0`0`0`0`0`0
	if(a1 != a2)`FunctionDecl,false;IfStmt,false;`1`0`0`0`0`0`0`0`1`0`0`0`2`0`1`2`0`0`0`1`0`0`0`0`0`0`2`0`2`0`0`0`1`0`0`1`0`0
		pre[a1] = a2;`FunctionDecl,false;IfStmt,false;`1`0`0`0`0`0`0`0`1`0`0`0`2`0`1`3`0`0`0`0`0`0`0`0`0`0`3`0`3`0`0`0`1`0`0`1`1`0
int main()`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0
	int p,l,ans = 0,have[111];`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`0`1`1`0`0`0`0`0`0`0`4`0`1`5`0`0`0`0`0`0`0`0`0
	memset(have,0,sizeof(have));`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`2`1`1`0`0`0`0`0`0`0`0`3`0`3`0`0`1`0`0`0`0`0`0
	cin >> p >> l;`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`3`0`0`0`0`0`0`0`0`0`0`5`0`5`0`0`0`0`0`0`0`0`0
	for(int i = 1;i <= 110;i++)`FunctionDecl,false;ForStmt,false;`1`0`1`0`0`0`0`0`0`0`0`0`2`0`1`2`2`2`0`0`1`0`0`0`1`1`2`1`4`0`0`0`1`1`0`2`0`0
		pre[i] = i;`FunctionDecl,false;ForStmt,false;`1`0`1`0`0`0`0`0`0`0`0`0`2`0`1`3`0`0`0`0`0`0`0`0`0`0`3`0`3`0`0`0`1`0`0`1`1`0
	for(int i = 0;i < p;i++)`FunctionDecl,false;ForStmt,false;`1`0`1`0`0`0`0`0`0`0`0`0`2`0`1`3`1`1`0`0`1`0`0`0`1`1`3`1`5`0`0`0`1`1`0`2`0`0
		int t;`FunctionDecl,false;ForStmt,false;`1`0`1`0`0`0`0`0`0`0`0`0`2`0`1`0`0`0`0`0`0`0`0`0`0`1`0`1`2`0`0`0`0`0`0`0`0`0
		cin >> t;`FunctionDecl,false;ForStmt,false;`1`0`1`0`0`0`0`0`0`0`0`0`2`0`1`2`0`0`0`0`0`0`0`0`0`0`3`0`3`0`0`0`0`0`0`0`0`0
		if(t == 0)`FunctionDecl,false;ForStmt,false;IfStmt,false;`1`0`1`0`0`0`0`0`1`0`0`0`3`0`2`1`1`1`0`1`0`0`0`0`0`0`1`0`1`0`0`0`1`0`0`1`0`0
			ans++;`FunctionDecl,false;ForStmt,false;IfStmt,false;`1`0`1`0`0`0`0`0`1`0`0`0`3`0`2`1`0`0`0`0`0`0`0`0`0`0`1`0`1`0`0`0`0`1`0`1`0`0
			int flag;`FunctionDecl,false;ForStmt,false;IfStmt,false;`1`0`1`0`0`0`0`0`1`0`0`0`3`0`2`0`0`0`0`0`0`0`0`0`0`1`0`1`2`0`0`0`0`0`0`0`0`0
			cin >> flag;`FunctionDecl,false;ForStmt,false;IfStmt,false;`1`0`1`0`0`0`0`0`1`0`0`0`3`0`2`2`0`0`0`0`0`0`0`0`0`0`3`0`3`0`0`0`0`0`0`0`0`0
			have[flag] = 1;`FunctionDecl,false;ForStmt,false;IfStmt,false;`1`0`1`0`0`0`0`0`1`0`0`0`3`0`2`2`1`1`0`0`0`0`0`0`0`0`2`0`2`0`0`0`1`0`0`1`1`0
			for(int i = 1;i < t;i++)`FunctionDecl,false;ForStmt,false;IfStmt,false;ForStmt,false;`1`0`2`0`0`0`0`0`1`0`0`0`4`0`3`3`1`1`0`0`1`0`0`0`1`1`3`1`5`0`0`0`1`1`0`2`0`0
				int te;`FunctionDecl,false;ForStmt,false;IfStmt,false;ForStmt,false;`1`0`2`0`0`0`0`0`1`0`0`0`4`0`3`0`0`0`0`0`0`0`0`0`0`1`0`1`2`0`0`0`0`0`0`0`0`0
				cin >> te;`FunctionDecl,false;ForStmt,false;IfStmt,false;ForStmt,false;`1`0`2`0`0`0`0`0`1`0`0`0`4`0`3`2`0`0`0`0`0`0`0`0`0`0`3`0`3`0`0`0`0`0`0`0`0`0
				mix(te,flag);`FunctionDecl,false;ForStmt,false;IfStmt,false;ForStmt,false;`1`0`2`0`0`0`0`0`1`0`0`0`4`0`3`2`0`0`0`0`0`0`0`0`0`0`3`0`3`0`1`1`0`0`0`0`0`0
				have[te] = 1;`FunctionDecl,false;ForStmt,false;IfStmt,false;ForStmt,false;`1`0`2`0`0`0`0`0`1`0`0`0`4`0`3`2`1`1`0`0`0`0`0`0`0`0`2`0`2`0`0`0`1`0`0`1`1`0
	for(int i = 1;i <= l;i++)`FunctionDecl,false;ForStmt,false;`1`0`1`0`0`0`0`0`0`0`0`0`2`0`1`3`1`1`0`0`1`0`0`0`1`1`3`1`5`0`0`0`1`1`0`2`0`1
		if(have[i] && pre[i] == i)`FunctionDecl,false;ForStmt,false;IfStmt,false;`1`0`1`0`0`0`0`0`1`0`0`0`3`0`4`5`0`0`0`1`0`0`0`0`0`0`5`0`5`0`0`0`2`0`0`2`2`0
			ans++;`FunctionDecl,false;ForStmt,false;IfStmt,false;`1`0`1`0`0`0`0`0`1`0`0`0`3`0`4`1`0`0`0`0`0`0`0`0`0`0`1`0`1`0`0`0`0`1`0`1`0`1
	cout << ans - 1 << endl;`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`2`1`1`0`0`0`0`0`0`0`0`5`0`5`0`0`0`1`0`0`1`0`0
    return 0;`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0