|  | 
|  | 
| вернуться в форум | impossible :) How can find difference in two codes?
 
 
 ----------------------1-------------------------
 
 void addVertex(int & a)
 {
 bool find = false;
 int len = v.size();
 int k = 0;
 for(int i = 0; i < len; i++)
 {
 if(v[i] == a)
 {
 a = i;
 k++;
 find = true;
 }
 }
 if(k > 1)
 {
 //throw 42;
 }
 if(!find)
 {
 v.push_back(a);
 a = v.size() - 1;
 part[a] = partNumber++;
 }
 }
 
 
 
 ------------------------------2----------------------
 
 void addVertex(int & a)
 {
 int len = v.size();
 for(int i = 0; i < len; i++)
 {
 if(v[i] == a)
 {
 a = i;
 return;
 }
 }
 v.push_back(a);
 a = v.size() - 1;
 part[a] = partNumber++;
 }
 
 If I use second function I get AC, but if I use first function I get WA 1. If in first add string "throw 42" then I get Crash 1.
 
 I use vector "v" only in this function.
 | 
 | 
|