c++ 报错 vector out of the range

读一个2016行的文件到vector里面,一直提示vector out of range。

我试着把vector大小改的很大还是有这个问题,所以不是一开始分配的大小不够,还有我测试过读文件的方法也是没有问题的。请问是哪里不对呢?

vector<vector<float>>contact(68, vector<float>(68, 0));
for (int k = 1;k <= 2016;k++)
{
    int row, column;
    infile >> row >> column;
    infile.get();
    infile.get();
    infile.get();
    infile.get();
    infile >> contact[row - 1][column - 1];
    contact[column-1][row-1]= contact[row-1][column-1];
    infile.get();
}

每次从文件内读入的 row 和 column 的值确定都在 [1, 68] 之间吗?
我建议在执行
infile >> contact[row - 1][column - 1];
这一行代码之前,增加一个异常判断
if (row <= 0 || row > 68 || column <= 0 || column > 68) { cerr << "blablabla..." << endl; continue; }
有时候直觉和猜测都不靠谱,加一些错误判断才是正解。