本文整理汇总了C++中vvi::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ vvi::resize方法的具体用法?C++ vvi::resize怎么用?C++ vvi::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vvi
的用法示例。
在下文中一共展示了vvi::resize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(){
int n;
cin>>n;
vi t;
t.resize(n,-1);
dp.resize(n,t); // dp is n X n
for(int i=0;i<n;i++){
int r,c;
cin>>r>>c;
vi temp;
temp.pb(r);
temp.pb(c);
matrices.pb(temp);
}
cout<<solve(0,n-1)<<endl;
int A;
cin>>A;
return 0;
}
示例2: main
int main ()
{
srand (time (0));
freopen ("input.txt", "r", stdin);
freopen ("output.txt", "w", stdout);
scanf ("%d %d", &n, &m);
g.resize (n + 1);
used.resize (n + 1, 0);
for (int i = 0; i < m; i++)
{
int x, y;
scanf ("%d %d", &x, &y);
g [x].pb (y);
num [x][y] = i + 1;
}
int st;
scanf ("%d", &st);
vi ans;
found = 0;
dfs (st, ans);
if ((int) ans.size () == 0)
{
puts ("-1");
return 0;
}
reverse (ans.begin (), ans.end ());
ans.pop_back ();
printf ("%d\n", (int) ans.size ());
for (int i = 0; i < (int) ans.size (); i++)
printf ("%d%c", ans [i], " \n" [i == (int) ans.size () - 1]);
return 0;
}
示例3: main
int main(){
ios::sync_with_stdio(0);
int n;
while(cin >> n) {
int a, num, b;
char c;
cont = 0;
dfs_num.clear();
dfs_num.resize(n, -1);
dfs_low.clear();
dfs_low.resize(n);
dfs_parent.clear();
dfs_parent.resize(n);
vec.clear();
vec.resize(n);
for (int i = 0; i < n; ++i) {
cin >> a >> c >> num >> c;
for (int j = 0; j < num; ++j) {
cin >> b;
vec[a].push_back(b);
}
}
for (int k = 0; k < n; ++k)
if (dfs_num[k] == -1)
artiBri(k);
sort(bri.begin(), bri.end());
cout << bri.size() << " critical links" << endl;
for (int l = 0; l < bri.size(); ++l)
cout << bri[l].first << " - " << bri[l].second << endl;
}
return 0;
}
示例4: main
int main(){
ios::sync_with_stdio(0);
int rel,network = 0;
string a,b;
while(cin >> V >> rel && (V||rel)){
int cont = -1;
map<string,int> nums;
adjmat.clear(); adjmat.resize(V+5,vi(V+5,inf));
for (int k = 0; k < V; ++k) {
adjmat[k][k] = 0;
}
for (int i = 0; i < rel; ++i) {
cin >> a >> b;
if(nums.find(a) == nums.end()) nums[a] = ++cont;
if(nums.find(b) == nums.end()) nums[b] = ++cont;
adjmat[nums[a]][nums[b]] = 1;
adjmat[nums[b]][nums[a]] = 1;
}
warshall();
int ans = -1;
for (int i = 0; i < V; ++i) {
for (int j = 0; j < V; ++j) {
//cout << adjmat[i][j]<<" ";
ans = max(ans,adjmat[i][j]);
}//cout<< endl;
}
cout << "Network "<< ++network << ": ";
if(ans == inf) cout << "DISCONNECTED\n\n";
else cout << ans << endl<<endl;
}
return 0;
}