Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
谁能告诉我怎么错了。。我过了样例了,真心求解答#include<iostream> #include<string> #include<map> #include<set> #include<vector> using namespace std; int main() { int num; int m[105][105]; multiset<int> v1, v2; memset(m, 0, sizeof m); cin >> num; while (num--) { int w, h, t; cin >> w >> h >> t; multimap<int, int> M; int n = t; while (t--) { int x, y; cin >> x >> y; M.insert(make_pair(x, y)); m[x][y] = 1; } for (std::multimap<int, int>::iterator it = M.begin(); it != M.end(); it++) { int x_2 = it->first; int y_2 = it->second; int x, y; int count = 0; for (x = x_2, y = y_2; m[x][y] && y < h; y++, count++); for (x = x_2, y = y_2; m[x][y] && y >= 0; y--, count++); for (x = x_2, y = y_2; m[x][y] && x < w; x++, count++); for (x = x_2, y = y_2; m[x][y] && x >= 0; x--, count++); v1.insert(count); } M.clear(); memset(m, 0, sizeof m); while (n--) { int x, y; cin >> x >> y; M.insert(make_pair(x, y)); m[x][y] = 1; } for (std::multimap<int, int>::iterator it = M.begin(); it != M.end(); it++) { int x_2 = it->first; int y_2 = it->second; int x, y; int count = 0; for (x = x_2, y = y_2; m[x][y] && y < h; y++, count++); for (x = x_2, y = y_2; m[x][y] && y >= 0; y--, count++); for (x = x_2, y = y_2; m[x][y] && x < w; x++, count++); for (x = x_2, y = y_2; m[x][y] && x >= 0; x--, count++); v2.insert(count); } if (v1 == v2) cout << "YES" << endl; else cout << "NO" << endl; v1.clear(); v2.clear(); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator