Common Board| Show all threads Hide all threads Show all messages Hide all messages | | If you have wa4 | Kirom `Ekexity [SESC17]💻 | 1205. By the Underground or by Foot? | 1 Dec 2023 22:26 | 2 | Try this test 1 100 4 1 1 2 1 3 1 4 1 1 2 3 4 0 0 0 1 5 1 Correct answer is: 3.0200000 4 1 2 3 4 | | get WA at test 41 | Fahim | 1014. Product of Digits | 1 Dec 2023 18:13 | 1 | #include<bits/stdc++.h> using namespace std; bool isPrime(int n) { if(n!=2&&n%2==0)return false; if(n<2)return false; for(int i=3;i<=sqrt(n);i+=2) { if(n%i==0)return false; } return true; } int main() { int n; cin>>n; int x=9,r; if(n==1)cout<<1<<endl; else if(n==0)cout<<10<<endl; else{ vector<int>v; while(1) { if(n%x==0) { if(isPrime(n)==true) { if(n>9){cout<<-1<<endl;return 0;} } n=n/x; if(x==1)break; v.push_back(x); } else { x--; } } for(int i=v.size()-1;i>=0;i--) { cout<<v[i]; } cout<<endl; } } | | Randomized algorithm also works | So Sui Ming | 1510. Order | 30 Nov 2023 20:04 | 1 | For large N, 2% of sample are counted. | | WA8 give me some tests | Michail Yudin | 1676. Mortal Kombat | 29 Nov 2023 23:38 | 4 | Thx a lot for every man and women for tests. Try this: 4 4 1111 1110 1100 1000 The answer: 1110 1101 1011 0111 My code gives right answer for this test, but still got WA8. My algo: 1) find any perfect match (I use kuhn algorithm). If there no perfect match print unary matrix and quit. 2) for every i-monster, remove edge (i, match(i)), and try make alternate path for i. save result in d[] array, and restore edge (i, match(i)) . 3) We can select (i,j) edge only if Mij = true AND (i,j) edge in perfect match, or j is free vertex, or d[ match( j ) ] is true. Can give some tests ? Test: 6 7 1111000 1110000 1100000 1000100 0000110 0000110 WA8 answer: 0000111 0001111 0011111 0111011 1111001 1111001 | | Some help for C++ authors | 198808xc | 1575. Yekaterinburg Subway 2 | 29 Nov 2023 19:24 | 8 | const int MaxLength = 30; const int Lines = 8; const int MaxStation = 15; const int Stations[Lines] = {13, 10, 11, 12, 9, 14, 15, 13}; const char Line[Lines][MaxStation][MaxLength + 1] = { {"7_klyuchey", "Sortirovochnaya", "China_town", "Zarechny", "City", "1905_year_square", "Kuybyshevskaya", "Sibirskaya", "Siniye_kamni", "Lechebnaya", "Varshavskaya", "Kompressornaya", "Koltsovo"}, {"Zelyony_ostrov", "Tatishchevskaya", "Verh_Isetskaya", "Kommunarov_square", "1905_year_square", "Teatralnaya", "Vostochnaya", "Vtuzgorodok", "Kamennye_palatki", "University"}, {"MEGA", "Metallurgov", "Kraulya", "Central_stadium", "Moskovskaya", "1905_year_square", "Shevchenko", "Pionerskaya", "Turbinnaya", "Elmash", "Taganskaya"}, {"Akademicheskaya", "Yugo_zapadnaya", "Volgogradskaya", "Posadskaya", "Geologicheskaya", "Teatralnaya", "Gagarinskaya", "Komsomolskaya", "Shefskaya", "Ozyornaya", "Italyanskaya", "Kalinovskaya"}, {"Sovhoznaya", "Voennaya", "Aviatsionnaya", "Dvorets_sporta", "Geologicheskaya", "Kuybyshevskaya", "Vostochnaya", "Gagarinskaya", "Vilonovskaya"}, {"Keramicheskaya", "Vtorchermet", "Samolyotnaya", "Botanicheskaya", "Parkovaya", "Mayakovskaya", "Oborony_square", "Kuybyshevskaya", "Teatralnaya", "Shevchenko", "Uralskaya", "Zvezda", "I_Pyatiletki_square", "Pobedy"}, {"Himmash", "Nizhne_Isetskaya", "Uktusskie_Gory", "Shcherbakovskaya", "Botanicheskaya", "Chkalovskaya", "Bazhovskaya", "Geologicheskaya", "1905_year_square", "Dinamo", "Uralskaya", "Mashinostroiteley", "Uralmash", "Prospekt_Kosmonavtov", "Bakinskih_Komissarov"}, {"Moskovskaya", "Kommunarov_square", "City", "Uralskaya", "Pionerskaya", "Gagarinskaya", "Vtuzgorodok", "Sibirskaya", "Oborony_square", "Bazhovskaya", "Dvorets_sporta", "Posadskaya", "Moskovskaya"} }; Thank you! You save my time. Thanks! :) Reformatted for C++ vector<vector<string>> a { {"7_klyuchey", "Sortirovochnaya", "China_town", "Zarechny", "City", "1905_year_square", "Kuybyshevskaya", "Sibirskaya", "Siniye_kamni", "Lechebnaya", "Varshavskaya", "Kompressornaya", "Koltsovo"}, {"Zelyony_ostrov", "Tatishchevskaya", "Verh_Isetskaya", "Kommunarov_square", "1905_year_square", "Teatralnaya", "Vostochnaya", "Vtuzgorodok", "Kamennye_palatki", "University"}, {"MEGA", "Metallurgov", "Kraulya", "Central_stadium", "Moskovskaya", "1905_year_square", "Shevchenko", "Pionerskaya", "Turbinnaya", "Elmash", "Taganskaya"}, {"Akademicheskaya", "Yugo_zapadnaya", "Volgogradskaya", "Posadskaya", "Geologicheskaya", "Teatralnaya", "Gagarinskaya", "Komsomolskaya", "Shefskaya", "Ozyornaya", "Italyanskaya", "Kalinovskaya"}, {"Sovhoznaya", "Voennaya", "Aviatsionnaya", "Dvorets_sporta", "Geologicheskaya", "Kuybyshevskaya", "Vostochnaya", "Gagarinskaya", "Vilonovskaya"}, {"Keramicheskaya", "Vtorchermet", "Samolyotnaya", "Botanicheskaya", "Parkovaya", "Mayakovskaya", "Oborony_square", "Kuybyshevskaya", "Teatralnaya", "Shevchenko", "Uralskaya", "Zvezda", "I_Pyatiletki_square", "Pobedy"}, {"Himmash", "Nizhne_Isetskaya", "Uktusskie_Gory", "Shcherbakovskaya", "Botanicheskaya", "Chkalovskaya", "Bazhovskaya", "Geologicheskaya", "1905_year_square", "Dinamo", "Uralskaya", "Mashinostroiteley", "Uralmash", "Prospekt_Kosmonavtov", "Bakinskih_Komissarov"}, {"Moskovskaya", "Kommunarov_square", "City", "Uralskaya", "Pionerskaya", "Gagarinskaya", "Vtuzgorodok", "Sibirskaya", "Oborony_square", "Bazhovskaya", "Dvorets_sporta", "Posadskaya", "Moskovskaya"} }; | | WA13 | Mortus | 1570. Eating High | 28 Nov 2023 23:59 | 1 | WA13 Mortus 28 Nov 2023 23:59 Check how you restore the answer. I had the right price , but it brought out fewer dishes than necessary | | WA 13 | SharpBlade | 1779. The Great Team | 28 Nov 2023 18:09 | 2 | WA 13 SharpBlade 2 Jun 2012 23:06 Can anyone say, what is wrong in my solution? public class T1779 { public static void main(String[] args) throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); PrintWriter out=new PrintWriter(System.out); int n=Integer.parseInt(in.readLine()); int sum=0; for(int i=0; i<n/2; i++){ for(int j=n-i-1; j<n; j++){ if(i!=j){ out.println((i+1)+" "+(j+1)); sum++; } } } System.out.println(sum); out.close(); } } Repalce the conditions i != j with i < j because you print some edges twice. Sorry for my bad English | | Gospers hack | Mahilewets Nikita [BSUIR] | 2024. Adventure Time | 28 Nov 2023 16:07 | 2 | Very good opportunity to apply Gosper's hack trick. m is number of different colors in the input. Then iterate through all subsets of size k of m. It's really works. But I don't understand why this algo work. Can you explain me? | | WA6 | Mortus | 1701. Ostap and Partners | 28 Nov 2023 13:56 | 1 | WA6 Mortus 28 Nov 2023 13:56 I was getting wa6 because the salary[0] not equal to 0 | | Can he eat his brothers and sisters? | Artem Fursenko [Brainstorm] | 1242. Werewolf | 28 Nov 2023 12:42 | 3 | oh, i got AC. If anybody want to know - yes, he can! I got WA on test #5 can you tell me why? | | Test Case for WA#5 | azikar24 | 1242. Werewolf | 28 Nov 2023 12:36 | 3 | This test case helped me. 6 1 2 2 4 4 5 5 6 BLOOD 3 5 Answer: 0 Why answer is not a 1 2 4? Edited by author 13.04.2019 11:10 I have ans = 0 but although it giving WA on test #5 can you suggest me some error or another test case | | WA39 | arclite | 2078. Bowling game | 28 Nov 2023 02:20 | 2 | WA39 arclite 30 Oct 2018 21:03 Re: WA39 Olympic Bear (Nikolay Dubchuk) 28 Nov 2023 02:20 I didn't check that p[9] == 10 when p[8] == 10, where p[1]...p[10] - points Edited by author 28.11.2023 11:41 | | Easy | Mickkie | 1764. Transsib | 25 Nov 2023 18:04 | 1 | Easy Mickkie 25 Nov 2023 18:04 No need to use simplex alg. Simple brute force linear programming done in O( Choose(10,4) * 4^3 ) time | | WA2 | Илья | 1211. Collective Guarantee | 25 Nov 2023 13:29 | 1 | WA2 Илья 25 Nov 2023 13:29 The 2nd test on the site does not pass, everything works for me, what should I do? | | note for WA#2 | hoan | 1211. Collective Guarantee | 25 Nov 2023 13:28 | 2 | try this test: input: 1 2 0 0 output: NO because for this sentences in the problem: "exactly one child has confessed the he (or she) had broken the cup". I dont notice to this and get WA#2. sorry for my poor english. GOOD LUCK! Edited by author 15.11.2010 23:48 I have a test on the website, no, what should I do? | | Cause of WA 9 | Ender | 1120. Sum of Sequential Numbers | 24 Nov 2023 20:51 | 2 | The probable cause of the error is the use of a floating point variable for computing of value a. Any floating point types have limited precision, and looks like some times it is not enough. Consider to use some integer types instead. | | What 3rd test | Vsevolod | 2066. Simple Expression | 23 Nov 2023 17:01 | 1 | | | very good test to pass WA#13 | luckysundog | 1629. Trip | 23 Nov 2023 15:13 | 4 | it helped me to pass WA#13 3 1 0 60 12:00 2 1430 45 23:00 0:00 got AC | | Ok funny | TUITUF_Bahrom | 1295. Crazy Notions | 22 Nov 2023 17:48 | 2 | | | Some Deductions on the Problem | orzczt | 2061. OEIS A216264 | 22 Nov 2023 03:09 | 6 | If you search for the id "A216264" on oeis.org, you would find a table of a(n), n=1..60. One interesting thing is that the site said that it was Mikhail Rubinchik who calculated a(26) to a(60), which happened to be out of the brute-force range. What is really disappointing is that in this problem, n may be 61, I think it's that guys's trick to play with us. Another interesting fact is that this guy also invented and introduced the Palindromic Tree. So, I deduce that the solution to this problem is somehow related to this data structure. Edited by author 03.04.2016 12:56 Yes, with eertree you can bruteforce all answers My solution runs ~20 hours to generate result, it can be theoretically speed up 2 times by bruteforcing only strings such s<=reverse(s) How could you bruteforce 2^61 strings of length 61? imagine a binary tree of these strings, use DFS with eertree https://iq.opengenus.org/palindromic-tree-eertree/ Use custom allocator with fixed 128 Node. struct NodeAllocator { Node nodes[128]; int pos = 0; Node* allocate() { assert(pos < 128); return nodes + (pos++); } }; std::uint64_t rich_number(std::uint64_t val, int pos, int n, EerTree& tree) { if (pos >= n) return 1; std::int64_t res = 0; for (std::uint64_t bit = 0; bit < 2; ++bit) { std::uint64_t s = val | (bit << pos); /********************************************/ Node* t_current = tree.current; int t_pos = tree.alloc.pos; /********************************************/ int r = tree.insert(s, pos); /********************************************/ Node* cur_change = tree.cur_change; /********************************************/ if (r == 1) { res += rich_number(s, pos + 1, n, tree); } /********************************************/ //reset tree insert back tree.current = t_current; tree.alloc.pos = t_pos; if (r==1){ cur_change->labeled[bit] = nullptr; } /********************************************/ } return res; } ------------ rich_number(0, 0, 61) -> gives 61-rich palindrome. My computer it runs 52 hours. Это да, супер Edited by author 22.11.2023 03:10 |
|
|