摘要:
1 /* 2 * 归并排序求逆序对 3 */ 4 5 #include <cstdio> 6 #include <iostream> 7 8 using namespace std; 9 10 const int N = 20005;11 12 long long ans;13 int a[N], b[N];14 15 void mergeSort(int left, int right) {16 int i, j, k, mid;17 if (left < right) {18 mid = (left + right) >> 1;19 ... 阅读全文
posted @ 2012-05-14 22:51
Try86
阅读(156)
评论(0)
推荐(0)
摘要:
1 /* 2 * 简单BFS 3 */ 4 5 #include <cstdio> 6 #include <cstring> 7 #include <iostream> 8 9 using namespace std;10 11 const int N = 2005;12 13 int map[N][N];14 bool vis[N][N];15 struct node {16 int x;17 int y;18 int c;19 }Q[N*N], s, e;20 int front, rear;21 int dir[4][2] = {{0, 1}, {.. 阅读全文
posted @ 2012-05-14 12:40
Try86
阅读(329)
评论(0)
推荐(0)