Show all threads Hide all threads Show all messages Hide all messages |
We can use O(n*prime(n)) to AC this problem.It's the most easy algorithms. | Зане | 1132. Square Root | 17 Nov 2019 23:08 | 2 |
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. |
WA1 | Dyryaev Daniil | 2114. My craft | 15 Nov 2019 01:31 | 2 |
WA1 Dyryaev Daniil 15 Nov 2019 01:26 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 Re: WA1 Dyryaev Daniil 15 Nov 2019 01:31 upd: Before I used scanf and got wa1. Now with cin // cout i have tle17. |
No subject | Roman Hrynevych | 1563. Bayan | 14 Nov 2019 22:45 | 1 |
Edited by author 14.11.2019 22:47 |
How can be z==2? | Valeriya Krinitsyna | 1428. Jedi Riddle | 13 Nov 2019 22:05 | 1 |
In the example 2 2 3, z==5. Why do everybody say that z==2? |
for python use sys.stdin | ai123ia | 1100. Final Standings | 12 Nov 2019 16:28 | 3 |
Thank you, dear! You are my saver! Thank. Now everything stopped at MLE |
Python3 MLE на 11 тесте | Desserg | 1100. Final Standings | 12 Nov 2019 16:26 | 1 |
есть ли способы на питоне обойти прожорливость памяти? |
WA#10! Help me please!!! | Pio | 1362. Classmates 2 | 12 Nov 2019 00:15 | 4 |
I also have WA10/ Help Someone! 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 !!! | Arm | 1362. Classmates 2 | 12 Nov 2019 00:15 | 2 |
9 8 2 0 4 3 0 0 5 6 0 0 0 0 9 0 7 0 1 correct answer 4 |
wa 10 | Michael Glushkov | 1489. Points on a Parallelepiped | 11 Nov 2019 21:39 | 1 |
wa 10 Michael Glushkov 11 Nov 2019 21:39 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); } } } |
WHY WA 5 | JAVATO | 1638. Bookworm | 11 Nov 2019 10:35 | 7 |
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 thank you very much:)))))))))))))))))))))))))))))))))))))))))))))))))))))) |
Whats wrong? C | Sanchir | 1001. Reverse Root | 10 Nov 2019 22:27 | 2 |
#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. |
Why Runtime Error (Access Violation)?? | Labib Bin Mohtaram | 1001. Reverse Root | 10 Nov 2019 22:25 | 2 |
[code deleted] Edited by moderator 19.11.2019 23:31 Your array size is not enough to hold all the integers. |
Why Runtime error on test 4?? | FromNothingToFinal | 1020. Rope | 10 Nov 2019 19:07 | 2 |
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 |
Advices with RE and WA | roman velichkin | 1020. Rope | 10 Nov 2019 19:07 | 1 |
Radius and coords can be float N can be 1 |
Some test cases | Smilodon_am [Obninsk INPE] | 2143. Victoria! | 9 Nov 2019 01:18 | 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 |
Is 1001 unlucky or 1010? | roman velichkin | 1608. Lucky Tickets 2008 | 8 Nov 2019 10:25 | 1 |
I didn't get this task. Is 1001 unlucky number or 1010? |
I know there O(N^3) solution, but how to get 0.001s ?? | xurshid_n | 1146. Maximum Sum | 7 Nov 2019 21:19 | 2 |
There a[i][j] in [-127..127] and n <= 100 -- May be there bitmask tricks, or other tricks???? There's one hard solution with quick matrix multiply |
Can anyone please explain the sample solution given in the problem | anupam ghosh | 2111. Plato | 7 Nov 2019 15:22 | 1 |
Can anyone please explain the sample solution given in the problem |
No subject | дед инсайд | 2144. Cleaning the Room | 7 Nov 2019 13:32 | 1 |
Edited by author 09.11.2019 20:00 |
Don't know what to do | Rodrigo Morales [UTEC] | 1014. Product of Digits | 7 Nov 2019 02:42 | 2 |
I have tried everything. Here are some testcases from my algorithm: 0: 10 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 25 12: 26 14: 27 15: 35 16: 28 18: 29 20: 45 21: 37 24: 38 25: 55 27: 39 28: 47 30: 56 Some big numbers: 16859136: 267778888 16875000: 3555555589 16934400: 355778889 16941456: 277777789 17006112: 48999999 17010000: 555567899 17146080: 256778999 17150000: 1555557778 17203200: 155788888 17210368: 177777888 17222625: 355579999 17280000: 555568889 17287200: 455777789 17294403: 177777777 17360406: 67799999 17364375: 555577799 17418240: 256788899 17496000: 355588999 17500000: 4555555578 17503290: 257777999 17561600: 455777888 17578125: 5555555559 17635968: 67889999 17640000: 555577889 17647350: 556777777 17694720: 256888889 17714700: 255699999 17718750: 2555555799 long long int minimoentero3(long int num) { long long int nf=result; return nf; } int main() { long int n; cin >> n;
cout<<minimoentero3(n); <- Here the result is sent. } Edited by author 26.10.2017 18:28 test 17294403: 177777777 17294403 != 177777777 (5764801) also 77777777 < 177777777 right answer for this test 377777777 |