Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
ac 0.015 | Dyryaev Daniil | 1654. Шифровка | 30 окт 2019 15:05 | 1 |
ac 0.015 Dyryaev Daniil 30 окт 2019 15:05 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cmath> #include <algorithm> #include <set> #include <vector> #include <string> #include <cstdlib> using namespace std; void optimization() { cin.tie(nullptr); ios_base::sync_with_stdio(false); } int main() { optimization(); string s; int k = -1; cin >> s; char c[200000]; for (char & i : c) { i = ' '; } for (char i : s) { if (k > -1) { if (c[k] == i) { c[k] = ' '; k--; } else { k++; c[k] = i; continue; } } else { k++; c[k] = i; } } for (char i : c) { if (i != ' ') { cout << i; } } return 0; } |
Easy problem | Maksimus El Diablo | 1272. Метро не в Екатеринбурге | 30 окт 2019 13:46 | 2 |
You can use Disjoint-set data structure. Too complicated for such an easy problem |
WA #5 | redenventeria | 1272. Метро не в Екатеринбурге | 30 окт 2019 13:45 | 3 |
WA #5 redenventeria 6 июл 2017 00:21 I can't help you without details of your algorithm. I have never encountered WA#5. I have some Stack-Overflow's because of critical mistake in my find_set function for Disjoint Set Union. After fixing AC. Edited by author 06.07.2017 09:50 You have to give us more information |
Solved(MST) | Luka Bulatovic | 1272. Метро не в Екатеринбурге | 30 окт 2019 13:43 | 5 |
Solution is Minimum spanning tree (Kruskal or Prim Algorithm). Put low cost on tunnels, and much higher one on bridges with using priority queue ;) The problem is much easier. You don't need to use Kruskal or Prim to solve it. Well, yes, but we can use this problem to train skills of writing MST algo =) You are trying to kill a fly with a nuclear Bomb :) Edited by author 30.10.2019 13:44 |
Runtime Error #12 on Python3 | Tihon Molotkov`~ | 1272. Метро не в Екатеринбурге | 30 окт 2019 13:40 | 2 |
It does not matter. Both DFS and BFS can be used to solve the problem. Yet, DFS code is shorter and nicer that BFS code. So, DFS is a better choice. So, I used DFS instead of BFS Edited by author 30.10.2019 13:41 Edited by author 30.10.2019 13:41 |
WA #8, WA #19 & TLE #23 | 👨🏻💻 Spatarel Dan Constantin | 1799. Саша и мажорные строки | 30 окт 2019 03:02 | 1 |
I managed to get rid of WA using these two test cases: in: 1 dcbbbdbdbbacaaaddbdcbbbdbbdbbadacbbaaddbaddbddacaa out: 15577 in: 1 abcccacccbcabaaaacbbabbcaaaaacaaaaacaacacbbacbcaba out: 15236 In test #23 it seems that n is large. So, to pass TLE #23, make sure your code is running fast enough for n = 100 000 and each test contains a single letter. |
Strange problem | Programmer | 1436. Рекламный щит | 30 окт 2019 02:36 | 3 |
I used ternary search for this problem limits -50000:50000 leads to wa18 -100000:100000 got wa1 -90000:90000 was AC is there a normal solution without finding such segment? Really strange! I got AC with 90000 limit too, using ternary search for an angle. Maybe, limits should be specified by variables? |
If you have WA #5 | Smilodon_am [Obninsk INPE] | 2113. Пережить потоп | 29 окт 2019 02:09 | 1 |
If you have WA #5 try below test: 2 5 2 3 9 2 100 1 2 5 4 100 2 1 1 5 Correct answer is 0. |
AC, but which test gives TLE!? | lnxdx | 2102. Миша и криптография | 29 окт 2019 00:41 | 1 |
Can someone provide a test, that makes the following code get TLE? // ITNOA #include<bits/stdc++.h> using namespace std; #define ll long long int main() { ll n; cin >> n; int cnt = 0; for (ll i = 2;i*i <= min((ll)1e18, n);i++) while (n%i == 0) { n /= i; cnt++; } if (n > 1) cnt++; if (cnt == 20) cout << "Yes\n"; else cout << "No\n"; } |
In case you have WA7 | Ilistratov | 1227. Чемпионат по ралли | 28 окт 2019 20:09 | 1 |
Graph can have loops and multiple edges. Edited by author 28.10.2019 20:10 |
Ответ для Pascal | Maxim Popkov | 1873. Летопись GOV | 28 окт 2019 15:01 | 1 |
var a:integer; begin read(a); if a=0 then write(5); if a=1 then write(21); if a=2 then write(12); if a=3 then write(2); if a=4 then write(1); if a=5 then write(4); if a=6 then write(6); if a=7 then write(1); if a=8 then write(4); if a=9 then write(4); if a=10 then write(1); if a=11 then write(0); if a=12 then write(1); if a=13 then write(1); end. Edited by author 28.10.2019 15:01 |
Because of p*=(i%m) was WA | Lieutenant | 1110. Степень | 28 окт 2019 11:48 | 2 |
Because of p*=(i%m) was WA. When I wrote p=(p*i)%m instead of p*=(i%m) then I got AC Why??? p*=(i%m) <==> p=p*(i%m) != (p*i)%m |
TLE 3 | Danny | 1448. Освещение в Хогвартсе | 27 окт 2019 15:25 | 1 |
TLE 3 Danny 27 окт 2019 15:25 |
WHY MLE ON TEST 7 PLEASE HELP MEEE | KiTe | 1306. Медиана последовательности | 26 окт 2019 00:07 | 1 |
MY CODE IS: #include<bits/stdc++.h> using namespace std; vector < int > heap; /////MINHEAP void ADD( int m ) { heap.push_back(m); int j = heap.size()-1; while( j != 1 && heap[j] < heap[j/2] ) { //SWAP int carry = heap[j/2]; heap[j/2] = heap[j]; heap[j] = carry; j /= 2; } return; } void REMOVEMIN() { heap[1] = heap[heap.size()-1]; heap.pop_back(); int j = 1; while( ( 2*j < heap.size() && heap[j] > heap[2*j] ) || ( 2*j+1 < heap.size() && heap[j] > heap[2*j+1] ) ) { if( 2*j+1 < heap.size() && heap[2*j] > heap[2*j+1] ) { //SWAP int carry = heap[j]; heap[j] = heap[2*j+1]; heap[2*j+1] = carry; j = 2*j+1; } else { //SWAP int carry = heap[j]; heap[j] = heap[2*j]; heap[2*j] = carry; j = 2*j; } } return; } int GETMIN() { return heap[1]; } int n, a; int main() { ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0); heap.push_back(-1); cin >> n; if( n % 2 == 0 ) { int m = n/2 + 1; while(n--) { cin >> a; ADD(a); if( heap.size() - 1 > m ) { REMOVEMIN(); } } int mid1 = GETMIN(); REMOVEMIN(); int mid2 = GETMIN(); bool f = 0; if( mid1 % 2 == 0 && mid2 % 2 == 0 ) cout << mid1/2 + mid2/2; else if( ( mid1 % 2 == 1 && mid2 % 2 == 0 ) || ( mid1 % 2 == 0 && mid2 % 2 == 1 ) ) cout << mid1/2 + mid2/2 << ".5"; else cout << mid1/2 + mid2/2 + 1; } else { int m = n/2 + 1; while(n--) { cin >> a; ADD(a); if( heap.size() - 1 > m ) { REMOVEMIN(); } } cout << GETMIN(); } return 0; } BUT WHY MLE? ?:'( Edited by author 26.10.2019 00:08 Edited by author 26.10.2019 00:09 Edited by author 26.10.2019 00:09 Edited by author 26.10.2019 00:09 |
What's test 4? | Moshkov Danil | 2112. Полевые логи | 25 окт 2019 21:28 | 3 |
I got WA4. Can somebody help? And RE 16... Edited by author 25.10.2019 21:31 Try this tests: 8 AAA BBB CCC DDD WWW XXX YYY ZZZ 11 YYY USES MEDKIT CCC USES MEDKIT YYY USES MEDKIT CCC USES MEDKIT WWW HIT BBB IN BODY WWW HIT YYY IN BODY YYY USES MEDKIT BBB HIT ZZZ IN BODY BBB HIT ZZZ IN BODY BBB HIT ZZZ IN BODY BBB HIT ZZZ IN BODY Answer (it can be another): CORRECT DDD CCC BBB AAA ZZZ YYY XXX WWW 8 AAA BBB CCC DDD WWW XXX YYY ZZZ 8 YYY USES MEDKIT YYY USES MEDKIT YYY USES MEDKIT YYY USES MEDKIT WWW HIT YYY IN BODY WWW HIT YYY IN BODY WWW HIT YYY IN BODY YYY USES MEDKIT Answer: FAKE |
problem | Misha | 1183. Brackets Sequence | 25 окт 2019 18:17 | 1 |
hello, can u sentme the right code of this programm? thank you very much coloteroritata@gmail.com |
Read statement carefully | medegor44 | 1872. Просторный офис | 19 окт 2019 16:58 | 1 |
Do not forget case for "Ask Shiftman for help" |
wa test 3 visual c++ | beslana | 1910. Руины титанов: сокрытый вход | 19 окт 2019 14:08 | 1 |
????? Edited by author 19.10.2019 23:42 |
AC but have a weird problem | fyq123 | 1446. Волшебная шляпа | 19 окт 2019 00:51 | 1 |
I use c++,my code is behind. But there is a weird problem . When i define n as int and use cin>>n,the program can't receive the name have more than two word or have symbols like '-'. So i have to define n as a string and transfer the string into a int,why this strange thing happen? #include<iostream> #include<string.h> #include<cstring> using namespace std; int main() { char room[4][1000][210]; memset(room,0,sizeof(room)); int k=0,nth[4]={0}; char n[10]; cin.getline(n,10,'\n'); int len=10; while(n[len]=='\0'){len--;} int temp=1; for(int i=len;i>=0;i--) { k+=(n[i]-48)*temp; temp*=10; } for(int i=0;i<k;i++) { char temp[210],temp1[20]; cin.getline(temp,210,'\n'); cin.getline(temp1,20,'\n'); if(temp1[0]=='S') { strcpy(room[0][nth[0]],temp); nth[0]++; } else if(temp1[0]=='H') { strcpy(room[1][nth[1]],temp); nth[1]++; } else if(temp1[0]=='G') { strcpy(room[2][nth[2]],temp); nth[2]++; } else { strcpy(room[3][nth[3]],temp); nth[3]++; } } /* omit so this is not a correct solution*/ } |
To admins — Is english statement correct? | Andrej Bourgasov | 1011. Кондукторы | 16 окт 2019 15:41 | 1 |
Hello! Seems there is a duplication in english statement of the problem: >> We know that there are more than P% conductors and less than Q% conductors of all citizens of Ekaterinburg. >>By percentage, we know that there are more than P% conductors and less than Q% conductors of all Russian citizens in this city |