|
|
Common Board Edited by author 17.11.2019 11:13 8 A B C D E F G H 6 A HIT B IN HEAD A HIT C IN HEAD A REVIVE B B REVIVE C A HIT D IN HEAD C REVIVE D Can anyone help me? I have no idea about how this test looks like. Any hints or tests? I have WA 30, what did you do to AC? Ok, I got AC after lots of WA 30 attempts by iterating over the input in the reversed order, which makes no sense to me. My current best guess is that test #30 is broken, so there are at least two correct answers and it accepts only one of them as correct. Of course, my algo can delete edges in different order depending on the order in which it iterates over them, but I'm pretty sure it always removes the maximum number of edges. So, when user starts looking for words, my program immediately writes the answer. Maybe that's why it isn't correct. For example: user -> 2 user -> ab program -> abc user -> xz program -> xzy We can qsort(n) and enumeration to solve it. Notice that n is a prime.There are 2500 primes under 32767. Enumeration can solve this problem. And every ask have mostly 2 answers.最多2个解 There are 3512 primes under 32767. I wrote the solution and had the correct answers on test cases, but i have wa1. Can someone help me or give advice? This is my solution: #include <iostream> #include <iomanip> #include <cmath> #include <algorithm> #include <numeric> #include <set> #include <map> #include <vector> #include <string> #include <cstring> #include <cstdlib> using namespace std; #define task void print(int array[], int n) { for (int i = 0; i < n; i++) { cout << array[i] << ' '; } } void optimization() { cin.tie(nullptr); ios_base::sync_with_stdio(false); } int factorial(int x) { int a = 1; for (int i = 2; i < x + 1; i++) { a *= i; } return a; } #ifdef task int main() { optimization(); int n, m; cin >> n >> m; int **field = new int *[n]; for (int i = 0; i < n; i++) { field[i] = new int[m]; } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> field[i][j]; } } int q; int k; int x = 0; int y = 0; int max_drop = -1; int part_sum = 0; int move_to_right = -1; cin >> q; for (int quest = 0; quest < q; quest++) { cin >> k; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { move_to_right = k + 1; part_sum = 0; for (int down = i; down < i + k + 1; down++) { for (int right = j; right < j + move_to_right; right++) { if (down < n && right < m) { part_sum += field[down][right]; } } move_to_right--; } if (part_sum > max_drop) { max_drop = part_sum; x = i + 1; y = j + 1; } } } cout << max_drop << ' ' << x << ' ' << y << endl; max_drop = -1; } return 0; } #endif upd: Before I used scanf and got wa1. Now with cin // cout i have tle17. Edited by author 14.11.2019 22:47 In the example 2 2 3, z==5. Why do everybody say that z==2? Thank you, dear! You are my saver! Thank. Now everything stopped at MLE есть ли способы на питоне обойти прожорливость памяти? I also have WA10/ Help Someone! I m too :\ 9 8 2 0 4 3 0 0 5 6 0 0 0 0 9 0 7 0 1 correct answer 4 some Test Please !!! 9 8 2 0 4 3 0 0 5 6 0 0 0 0 9 0 7 0 1 correct answer 4 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _1489 { class Point { public double x; public double y; public double z; static void Main(string[] args) { int A, B, C; string S = Console.ReadLine(); string[] SS = S.Split(); A = Convert.ToInt32(SS[0]); B = Convert.ToInt32(SS[1]); C = Convert.ToInt32(SS[2]); double x1, y1, x2, y2; double[] mas = Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); x1 = Convert.ToDouble(mas[0]); y1 = Convert.ToDouble(mas[1]); double[] mas2 = Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); x2 = Convert.ToDouble(mas2[0]); y2 = Convert.ToDouble(mas2[1]); Point a = new Point();
// A - x B - y C - z // x if (x1 <= C) a.x = 0; else if (x1 <= C + A) a.x = x1 - C; else a.x = A; // y if (y1 <= B) a.y = B - y1; else if (y1 <= B + C) a.y = 0; else if (y1 <= 2 * B + C) a.y = y1 - B - C; else a.y = B; // z if (y1 <= B) a.z = 0; else if (y1 <= B + C && x1 <= C + A && x1 >= C) a.z = y1 - B; else if (x1 <= C && y1 <= 2 * B + C) a.z = x1; else if (x1 >= C + A && y1 <= 2 * B + C) a.z = A + C + C - x1; else if (y1 >= B + C + B) a.z = 2 * (B + C) - y1; else a.z = C;
Point b = new Point();
// x if (x2 <= C) b.x = 0; else if (x2 <= C + A) b.x = x2 - C; else b.x = A; // y if (y2 <= B) b.y = B - y2; else if (y2 <= B + C) b.y = 0; else if (y2 <= 2 * B + C) b.y = y2 - B - C; else b.y = B; // z if (y2 <= B) b.z = 0; else if (y2 <= B + C && x2 <= C + A && x2 >= C) b.z = y2 - B; else if (x2 <= C && y2 <= 2 * B + C) b.z = x2; else if (x2 >= C + A && y2 <= 2 * B + C) b.z = A + C + C - x2; else if (y2 >= B + C + B) b.z = 2 * (B + C) - y2; else b.x = C;
double difx = (a.x - b.x); double dify = (a.y - b.y); double difz = (a.z - b.z); //if (difx * difx + dify * dify + difz * difz > 0) Console.WriteLine((Math.Sqrt(difx * difx + dify * dify + difz * difz))); //else Console.Write(0); } } } TEST PLEASE I'm also getting WA5. Please help. try this tests: 1)in: 10 1 2 1 ans: 22 2)in: 10 1 1 1 ans: 10 thanks a lot. thank you very much:)))))))))))))))))))))))))))))))))))))))))))))))))))))) #include <stdio.h> #include <math.h> main(void) { long long i; while(scanf("%lli", &i) != EOF) printf("%.4f\n", (double)sqrt(i)); } You have print the integers in reverse order of the input sequence. [code deleted] Edited by moderator 19.11.2019 23:31 Your array size is not enough to hold all the integers. public class Problem { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int r = sc.nextInt(); double l = 0; if (n != 1) { double x1 = sc.nextDouble(); double y1 = sc.nextDouble(); double memoryX = x1, memoryY = y1; for (int i = 1; i <= n; i++) { if (i == n) { l += Math.sqrt((memoryX - x1) * (memoryX - x1) + (memoryY - y1) * (memoryY - y1)); continue; } double x = sc.nextDouble(); double y = sc.nextDouble(); l += Math.sqrt((x - memoryX) * (x - memoryX) + (y - memoryY) * (y - memoryY)); memoryX = x; memoryY = y; } } l += 2*Math.PI*r; System.out.printf("%.2f", l); sc.close(); } } radius can be float number Radius and coords can be float N can be 1 Below test cases helped me to check the program: 2 3 .**|_|**. **.|_|*** ans: [good test] POBEDA 1A 2C 1F 5 6 ...|_|*** ...|_|*** ...|_|*** ...|_|*** ...|_|*** ans: POBEDA 1A 1C 3A 3C 5A 5C 5 12 ...|_|... ...|_|... ...|_|... ...|_|... ...|_|... ans: POBEDA 1A 1C 3A 3C 5A 5C 1D 1F 3D 3F 5D 5F 6 6 *..|_|*** ...|_|*** ...|_|*** ...|_|*** *..|_|*** ..*|_|*** ans: POBEDA 1C 2A 3C 4A 5C 6A 6 6 *..|_|*** ..*|_|*** ...|_|*** ...|_|*** *..|_|*** ...|_|*** ans: POBEDA 1C 2A 3C 4A 5C 6A 6 6 *..|_|*** *.*|_|*** ...|_|*** ...|_|*** *..|_|*** ...|_|*** ans: PORAZHENIE I didn't get this task. Is 1001 unlucky number or 1010? |
|
|