| Show all threads Hide all threads Show all messages Hide all messages |
| if you have WA6 | Viktor Krivoshchekov`~ | 1501. Sense of Beauty | 28 Nov 2019 17:15 | 1 |
|
| How to get AC with 0.02 s (mine is 0.7 s)??(-) | Miguel Angel | 1152. False Mirrors | 28 Nov 2019 15:20 | 7 |
I used bitwise operations (we can represent each subset as number between 1 and 2^n - 1), this AC'ed with 0.031s, may be you can further improve it .. Well, I used DP on subsets, but can't get faster than 0.093. Is there any special trick? I used bitmask... AC on 0.015 probably they just upgraded the machine from 2011, that's why you are faster than others :P I get 0.015 and used queue for each recount |
| C# | Faxfox | 1149. Sinus Dances | 28 Nov 2019 11:48 | 1 |
C# Faxfox 28 Nov 2019 11:48 using System; class Test { public static void Main() { String strB = ""; String strA = ""; int num = Convert.ToInt32(Console.ReadLine()); int b = 1; for (int a = num; a > 0; a--) { strA = StrAMaker(a); strB = ')' + strA + '+' + b + strB; b++; } string s3 = new string('(', --num); strB = s3 + strB.TrimStart(')'); Console.WriteLine(strB); } public static string StrAMaker (int a) { string s1 = new string(')', a); String s2 = ""; for (int i = 1; i <= a; i++) { if (i % 2 == 0) { s2 = s2 + "sin(" + i + "+"; if (i == a) s2 = s2.TrimEnd('+') + s1; } else { s2 = s2 + "sin(" + i + "-"; if (i == a) s2 = s2.TrimEnd('-') + s1; } } return s2; } } |
| Help me, please! What is wrong? c++ | Koloskova Mariia | 1196. History Exam | 28 Nov 2019 01:42 | 3 |
#include <iostream> using namespace std; int main() { int n,m,teacher[1500],student[100000],same=0; cin>>n; for(int i=0;i<n;i++) cin>>teacher[i]; cin>>m; for(int i=0;i<m;i++) cin>>student[i];
for(int i=0;i<n;i++) for(int j=0;j<m;j++) if(teacher[i]==student[j]) same++;
cout<<same; return 0; }
Each date is a positive integer not exceeding 10^9, long long int teacher[], student[] #include <bits/stdc++.h> using namespace std; #define ll long long int main(){ int n1, n2; cin >> n1; vector <int> m1; vector <int> m2; m1.resize(n1); for (int i = 0; i < m1.size(); i++) cin >> m1[i]; cin >> n2; m2.resize(n2); for (int i = 0; i < m2.size(); i++) cin >> m2[i]; int sum = 0; sort(m1.begin(), m1.end()); for (int i = 0; i < m2.size(); i++){ if (binary_search(m1.begin(), m1.end(), m2[i])) sum ++; } cout << sum; return 0; } |
| test 7 | Maxim | 1106. Two Teams | 27 Nov 2019 12:52 | 3 |
test 7 Maxim 10 Dec 2015 16:30 Did you find solution for 7th test? Test 7 please. Edited by author 27.11.2019 12:53 |
| WA#6 | Steve | 1551. Sumo Tournament | 26 Nov 2019 23:46 | 2 |
WA#6 Steve 26 Nov 2019 18:33 Can someone send test 6 please? Thanks Yes i can, but you so glup for this |
| вопрос снят | Desserg | 1502. Domino Dots | 26 Nov 2019 11:31 | 2 |
Edited by author 26.11.2019 11:33 Как удалить тему? Edited by author 26.11.2019 11:32 Edited by author 26.11.2019 11:32 |
| Sqrt-Decomposition solution | BasselBakr | 1846. GCD 2010 | 26 Nov 2019 09:18 | 2 |
I used sqrt-decomposition and got AC in 358ms My idea was like this: 1. Keep an array of the elements we have so far 2. For each sqrt-size block of the array compute the GCD 3. To insert an element: append it to the array and update its block 4. To remove an element: swap the element to be deleted with last element (I used a set of pairs<value, index> to get them quickly) and update their blocks Insert (sqrt n) Delete (sqrt n) O(q sqrt n) where n is number of elements in the array Do you mean that after every insertion, we have to update the block containing the element as well as the block size? If block size is also updated, then shouldn't we have to update the whole array we've had so far? I used sqrt too but in a slightly different way from yours. I read all the queries and store all the values of query + to an array, decide the block size and compute GCD for each block. Then I loop the array again to answer the queries. If it is query +, I simply increase the counter x and call GCD(a[1..x]) (because I completely computed GCD of all blocks before). If it is query -, I erase x in the present array. Specifically, I recompute the GCD of the block without erased value x. This way caused me TLE on test #17, though :(( |
| WA for test 5 | Md. Mostafizur Rahman | 2002. Test Task | 26 Nov 2019 01:53 | 2 |
please can anyone tell me what is the test of 5. |
| C++ answer | gleb@il | 2100. Wedding Dinner | 26 Nov 2019 00:19 | 1 |
#include <iostream> #include <string> using namespace std; int main() { int n,g=2; cin >> n; for(int i = 0; i < n; i++) { string a; cin >> a; if(a.length() > 4 && a.substr(a.length()-4,a.length()-1) == "+one") g+=2; else g++; } if(g == 13) cout << 1400; else cout << g*100; } |
| WA11 | DSharipov | 1441. From the History of Gringotts Bank | 23 Nov 2019 04:32 | 1 |
WA11 DSharipov 23 Nov 2019 04:32 |
| WHY WA ON TEST #4??I am really stuck in this!!!plz help! | michel mizrahi | 1020. Rope | 20 Nov 2019 17:27 | 6 |
I can't understand what's wrong with my code is my algorithm wrong? or what? my code: #include <stdio.h> #include <math.h> double x[102],y[102]; double dist(int i, int j){ int d1=abs(x[i]-x[j]),d2=abs(y[i]-y[j]); if(d1==0) return (d2); else if(d2==0) return (d1); else return sqrt(d1*d1 + d2*d2); } int main(){ int i; double n,s=0,r,pi=2*acos(0); scanf("%Lf %Lf",&n,&r); for(i=0;i<n;i++) scanf("%Lf %Lf",&x[i],&y[i]); for(i=1;i<n;i++) s+=dist(i,i-1); s+=dist(0,n-1); s+=2*pi*r; printf("%.2Lf\n",s); return 0; } if someone can help me I would appreciate very much thanks! Your algorithm is right. But it seems to me very strange, that d1 and d2 in your code are integers, while x and y are not. double x[102],y[102]; double dist(int i, int j){ int d1=abs(x[i]-x[j]),d2=abs(y[i]-y[j]); ...} And double n seems strange to me too. Test #4: 3 1.2 12.24 13.34 0.00 24.75 -33.36 70.12 Solution: 153.41 thank you both of you guys :D!!!!!! (and sorry for my bad english :$) I finally got ac, just some stupid and silly mistakes! the answer should be 149.64 isn't it??? where am I wrong? . Edited by author 20.11.2019 17:29 |
| re16 | Moshkov Danil | 2112. Battle log | 20 Nov 2019 12:50 | 2 |
re16 Moshkov Danil 17 Nov 2019 10:44 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 |
| WA 7 | 👨💻Stepavly👨💻 [ITMO] | 2147. City Building | 18 Nov 2019 22:59 | 1 |
WA 7 👨💻Stepavly👨💻 [ITMO] 18 Nov 2019 22:59 Can anyone help me? I have no idea about how this test looks like. |
| WA 30 | Disintegrator | 1389. Roadworks | 18 Nov 2019 19:14 | 4 |
WA 30 Disintegrator 8 Apr 2014 03:36 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. |
| idk why but my code do not work on TOJ compiler but it works on my pycharm compiler | Oleg Bozhenov | 1542. Autocompletion | 18 Nov 2019 03:36 | 1 |
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 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? |