class TheMoviesLevelOneDivOne {
public:
long long find(int n, int m, vector <int> row, vector <int> seat) {
lli ret = 0;
ret += (lli)n * (lli)(m - 1);
set< pair< pair<int, int>, pair<int, int> > > taboo;
for (int i = 0; i < row.size(); ++i) {
int x = row[i], y = seat[i];
pair<int, int> a = make_pair(x, y);
pair<int, int> b = make_pair(x, y - 1);
pair<int, int> c = make_pair(x, y + 1);
if (y != 1) {
taboo.insert( make_pair(b, a) );
}
if (y != m) {
taboo.insert( make_pair(a, c) );
}
}
return ret - (lli)taboo.size();
}
};
10/20/2011
SRM469 Div1 Easy
250
登録:
コメントの投稿
(
Atom
)
0 件のコメント :
コメントを投稿