Here is some input - output for those getting WA. Also note that you don't need to use edmonds-karp/ford-fulkerson algorithm to solve this problem. It's a bipartite graph and can be solved by an n^3 algorithm explained here. http://www.geeksforgeeks.org/maximum-bipartite-matching/ Output for this i...
Test data generator. #include <iostream> #include <cstdlib> #include <ctime> #include <vector> #include <algorithm> using namespace std; struct point { int x, y; bool operator == (point p) { return x == p.x && y == p.y; } }; int main(int argc, char *argv[]) { srand(time(NULL)); for (int c = 1; c <= ...
Test data generator: #include <iostream> #include <ctime> #include <cstdlib> #include <cstring> using namespace std; int main(int argc, char *argv[]) { srand(time(NULL)); int M, N, D, start, end, height, linked[410][410]; int cases = 1000; cout << cases << '\n'; for (int c = 1; c <= cases; c++) { M ...
Test data generator: #include <iostream> #include <ctime> #include <cstdlib> using namespace std; int main(int argc, char *argv[]) { srand(time(NULL)); int x, y; for (int c = 1; c <= 1000; c++) { if (c > 1) cout << '\n'; for (int i = 1; i <= 1000; i++) { x = rand() % 1000 * (rand() % 2 == 0 ? 1 : -1...
Test data generator: #include <iostream> #include <ctime> #include <cstdlib> #include <set> #include <string> using namespace std; int main(int argc, char *argv[]) { srand(time(NULL)); int cases = 5; set<long long int> produced; for (int c = 1; c <= cases; c++) { int n = rand() % 100 + 1; cout << n ...
Test data generator: #include <iostream> #include <ctime> #include <cstdlib> #include <map> using namespace std; int main(int argc, char *argv[]) { srand(time(NULL)); int cases = 1000, x1, y1; for (int c = 1; c <= cases; c++) { int n = rand() % 100; int lengthOfString = rand() % 10000 + 1; cout << n...
You need to notice the type T movement, if Knight stands (1, 1) at start in a board with size 20*20, It can move to (20, 1) or (1, 20), but not (2,1), (1,2), (4,1), (1, 4), ... remember that the movement is mirror reflection with respect to board and one of axes parrelle to board sides. Secondly, th...
Comfirmed by using assert in C++:
(1) There is no dupciliated point in star map or constellation in judge data.
(2) There is no need to handle symmetrical constellations, because all constellation are not symmetrical in judge data.
Test data generator. #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main(int argc, char *argv[]) { srand(time(NULL)); int cases = 100; cout << cases << '\n'; for (int c = 1; c <= cases; c++) { int x = rand() % 198 + 3; int y = rand() % 198 + 3; int z = rand() % 198 ...