For the time being, to the point where it was solved. .. .. After the end, check if there was any consideration of the solved problem Read the editorial and consider the problems that could not be solved. .. .. Even if it is incomprehensible. .. .. To improve your thinking ability (ry)
I plan to come back to work on the remaining problems when I level up a little more
--I'm glad I did Educational DP Contest -The length of $ LCS + 1 $ is [True / $ p $ character fixed] --LCS commentary -[Slideshare material created by id: nitoyon]((slideshare) https://www.slideshare.net/nitoyon/ss-1086077) -[Organize typical DP (Dynamic Programming) patterns Part 1 ~ Knapsack DP ~](https://qiita.com/drken/items/a5e6fe22863b7992efdb#%E5%95%8F%E9%A1% 8C-8% E6% 9C% 80% E9% 95% B7% E5% 85% B1% E9% 80% 9A% E9% 83% A8% E5% 88% 86% E5% 88% 97-lcs-% E5 % 95% 8F% E9% A1% 8C) -Lecture materials of Japan Advanced Institute of Science and Technology? --Programming Contest Challenge Book (P.56-P.57)
private void solveA() {
String s1 = next();
String s2 = next();
if (s1.isEmpty() || s2.isEmpty()) {
out.println(0);
return;
}
int l1 = s1.length();
int l2 = s2.length();
int[][] dp = new int[l1 + 1][l2 + 1];
for (int i = 1; i <= s1.length(); i++) {
for (int j = 1; j <= s2.length(); j++) {
if (s1.charAt(i - 1) == s2.charAt(j - 1)) {
dp[i][j] = dp[i - 1][j - 1] + 1;
} else {
dp[i][j] = Integer.max(dp[i][j - 1], dp[i - 1][j]);
}
}
}
out.println(dp[l1][l2] + 1);
}
-I don't remember the vector cross product. So I couldn't solve this problem. .. .. -Since I failed to classify various cases, I gave up solving and moved to C.
--Reference -Problem explanation -Math lover's site
/**
*Vector cross product
*Cross product orientation
*/
private void solveB() {
int x = nextInt();
int y = nextInt();
int a = nextInt();
int b = nextInt();
int[] s = IntStream.range(0, 2).map(i -> nextInt()).toArray();
int[] t = IntStream.range(0, 2).map(i -> nextInt()).toArray();
boolean vect1 = s[0] * (b - a) - (s[1] - a) * x > 0;
boolean vect2 = t[0] * (b - a) - (t[1] - a) * x > 0;
out.println(vect1 == vect2 ? "No" : "Yes");
}
--Coordinate compression, right?
private void solveC() {
int numN = nextInt();
int[] wk = new int[numN];
Set<Integer> wkL = new TreeSet<Integer>();
for (int i = 0; i < wk.length; i++) {
wk[i] = nextInt();
wkL.add(wk[i]);
}
List<Integer> tmp = new ArrayList<Integer>();
tmp.addAll(wkL);
Collections.sort(tmp);
for (int i = 0; i < wk.length; i++) {
int position = Collections.binarySearch(tmp, wk[i]);
position = position >= 0 ? position : ~position;
out.println(position + 1);
}
}