Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
What wrong? Solution or syntax output ? | isVios | 1002. Телефонные номера | 6 май 2022 01:00 | 1 |
module Main where -------------------------------------------------------------------------------- toCandetat :: Char -> [Char] toCandetat '0' = "oqz" toCandetat '1' = "ij" toCandetat '2' = "abc" toCandetat '3' = "def" toCandetat '4' = "gh" toCandetat '5' = "kl" toCandetat '6' = "mn" toCandetat '7' = "prs" toCandetat '8' = "tuv" toCandetat '9' = "wxy" toCandetat n = error "unkown numb" -------------------------------------------------------------------------------- convertToCandedat :: String -> [String] convertToCandedat = map toCandetat -------------------------------------------------------------------------------- testWord :: String -> [String] -> Bool testWord str can = and $ zipWith elem str can -------------------------------------------------------------------------------- loop :: [String] -> String -> String loop [] acc = tail acc loop ["-1"] acc = tail acc loop in_str acc = loop next (acc ++ "\n" ++ fixPart) where fixPart = if part == "" then "No soluton." else part part = partSolve test cand [] (numb:count:xs) = in_str cand = convertToCandedat numb int_count = read count (test, next) = splitAt int_count xs -------------------------------------------------------------------------------- partSolve :: [String] -> [String] -> String -> String partSolve [] [] acc = tail acc partSolve (x:xs) can acc | testWord x can = skipX ++ nextXs | otherwise = partSolve xs can acc where lenX = length x skipX = partSolve xs can acc nextXs = partSolve xs (drop lenX can) (acc ++ " " ++ x) partSolve _ _ _ = "" -------------------------------------------------------------------------------- main :: IO () main = do in_str <- getContents putStr $ loop (words in_str) [] -------------------------------------------------------------------------------- |
WA11(12) Vs MyTests | Chidori-kun | 1195. Крестики-нолики | 4 май 2022 16:56 | 7 |
Anti WA11 Test: #X# #OX XOO Crosses win Anti WA12 Test: #X# O#O XOX Crosses win I hope these tests will be useful for you....... thanks a lot, i've AC with your test! It turns out that wrong tests are given. In a condition it is told that one player can win party one course. And it turns out what not one. No! "Head Judge observed that one player was able to win the game in one move." But Head Judge could be wrong. :) Is that true? Or i shouldn't implement case when nobody could win in one move? My code answers correct to your test cases, but Online Judge is saying W#11, I cannot find any case my solution fails. Can you provide more test cases, pls? And how people find the test case, do they figure it out or is there any way to know? У меня WA 9 и эти тесты работают |
WA15 | Yaroslav | 1195. Крестики-нолики | 4 май 2022 16:53 | 2 |
WA15 Yaroslav 1 янв 2022 20:34 Try this X## O#X XOO Crosses win But description says that one of teams must win in one move if we imagine that its their turn So I think that this test cant be real |
How fast could recursion optimised? | 👾_challenger128_[PermSNRU] | 1298. Конь | 2 май 2022 12:12 | 2 |
My AC recursion for n=8 gives about 8250733 calls. What is the minimum recursive calls value? My recursion gives only 64 for n=8. I sort moves by count of free cells that can be reached from them. |
Stupid problems (spoiler) | andreyDagger | 1755. Торт | 1 май 2022 16:49 | 1 |
There are 3 problems, which can be solved stupidly in two ternary searches: 1755 (this), 1633, 1874 |
Why it's wrong? | Solaiman Shadin | 1409. Два бандита | 1 май 2022 13:03 | 1 |
#include<stdio.h> int main() { int h, l; scanf("%d %d", &h, &l); int total = h + l; printf("%d %d\n", total - l - 1, total - h - 1); return 0; } |
What is DP solution? Thx | Dmitriy | 1203. Научная конференция | 30 апр 2022 18:16 | 6 |
Hi. I wonder, how can I solve it with dp? I thinked a whole day and cant find the solution less than O(N*T). Give me please some hint. Just sort by endtime and use greedy. It's that easy. Why does it work? Can you prove that approach? I don't understand why it does work :(. O(N * T)? What is 'T'? This can be solved using greedy, but the O(N^2) DP solution is as follows: 1) Sort by start times dp[i]: maximum events that can be attended
iterate from j = 0 to i-1, if end time of j-th conference is less than start time of i-th and dp[j] + 1 > dp[i] then dp[i] = dp[j] + 1 answer is max of all elements of dp array You should save dp[max(end_time)]; remember that for each end time there maybe different start times so that (end - start) are different. Save these segments, mp[end].push_back(end-start + 1); now check from 1 to max(end_time) and for each i, if i is end time? then check this segments sizes, for each such segment dp[i] = 1 + dp[i - s]; where s is saved segment sizes for end time 'i'. https://pastebin.com/C3dagNL2 Edited by author 30.04.2022 18:18 |
Good simulation problem | silverfox | 1131. Копирование | 28 апр 2022 22:29 | 1 |
Hint: we start from kk = 1, then kk += kk (2), kk += kk (4) but we cannot advance when kk > k. get to the maximum kk with this and the remaining n - kk can be easily calculated with (n - kk) / k + (((n - kk) % k) > 0) |
Use array of bitset | Сонечка | 1249. Древний некрополь | 24 апр 2022 16:01 | 2 |
Or array of vector <bool>. It uses less memory too. |
tle in c++ and ac in java | alphaplus | 1208. Соревнование легендарных команд | 24 апр 2022 12:49 | 3 |
my same logic got tle in c++ but AC in java so beware LOL. That's interesting. Could you share code please? That's because in Java objects like String pass by their links, when in C++ strings pass by their values(all chars). So when you move a string in Java you do less operations than you do in C++ Edited by author 24.04.2022 12:50 |
Hint | basuki | 1491. Нереальная история | 24 апр 2022 11:50 | 2 |
Hint basuki 25 мар 2019 08:32 Segment Tree/ Fenwick Tree with range update and point query Too expensive for this problem. You can just add c to some array[a] and add -c to array[b + 1]. So when you need to print the answer, you just do loop through all knights from 1 to n and firstly add value from array[i] to some variable, then print this variable. |
WA#15 | hduads2022_20321227 | 1628. Белые полосы | 24 апр 2022 11:34 | 1 |
WA#15 hduads2022_20321227 24 апр 2022 11:34 please give me some tips! Edited by author 24.04.2022 16:19 |
Python3 answer | Evgeniy | 1787. Поворот на МЕГУ | 23 апр 2022 15:50 | 3 |
k, n = [int(x) for x in input().split()] a = list(map(int, input().split())) m = 0 for i in a: m += i if (m - k >= 0): m -= k else: m = 0 print(m) explain please. for whar we need n then? try this example: 4 3 1 5 6 You cannot pass the sixth test. In the first minute there are 0 cars left. In the second minute there was 1 car left. At the third minute there were 2+1 cars left. Read the conditions of the task more carefully. )))) |
if you have #WA 8 ... try this test case... | Adhambek | 2034. Корованы | 22 апр 2022 13:45 | 5 |
6 6 1 2 2 3 3 4 4 5 1 6 6 5 1 5 6 ans : 0 oh,no!my answer is 0 but WA in test 8...... Actually it's 0. We should stay in 6, since there is only 1 shortest path. I have an another test case: 8 8 1 2 1 6 2 4 6 7 3 4 4 5 7 8 5 8 1 8 3 Answer: 3 |
USE e=0.000000001 to get AC | samplex | 1011. Кондукторы | 21 апр 2022 19:48 | 3 |
With e=0.0000001 I have WA#14 with 0.000001 i got AC Me too. round(v, 6) in Python. |
Test for WA 1 | _Otabek | 1018. Двоичная яблоня | 21 апр 2022 19:37 | 1 |
7 5 1 2 20 2 5 100 2 3 20 6 3 70 4 1 10 3 7 5 Answer: 220 Edited by author 21.04.2022 19:37 |
WRONG ANSWER ON TEST #3??? | the114514 | 1012. K-ичные числа. Версия 2 | 21 апр 2022 18:36 | 1 |
#include <iostream> #include <string> #include <cmath> #include <cstdio> #include <cctype> #include <cstring> #include <iomanip> #include <cstdlib> #include <ctime> #include <set> #include <map> #include <utility> #include <queue> #include <vector> #include <bitset> #include <stack> #include <sstream> #include <algorithm> #define ll long long using namespace std; #define maxn 1805 #define maxk 1805 const int MAX_ONE = 1000000000; struct x86_64 { int Length = 0, BigNum[1024] = {}; x86_64(int Num = 0) { int Index = 0; while (Num) { BigNum[Index++] = Num % MAX_ONE; Num /= MAX_ONE; } Length = Index; } void operator =(int Num) { memset(BigNum, 0, sizeof(BigNum)); int Index = 0; while (Num) { BigNum[Index++] = Num % MAX_ONE; Num /= MAX_ONE; } Length = Index; } }; void print(x86_64 Num) { for (int i = Num.Length - 1; i >= 0; i--) { if (i != Num.Length - 1) { printf("%09d", Num.BigNum[i]); } else { printf("%d", Num.BigNum[i]); } } } x86_64 operator +(x86_64 A, x86_64 B) { int Length = max(A.Length, B.Length); int Carry = 0; x86_64 Answer; for (int i = 0; i < Length + 1; i++) { Answer.BigNum[i] = (A.BigNum[i] + B.BigNum[i] + Carry) % MAX_ONE; Carry = (A.BigNum[i] + B.BigNum[i] + Carry) / MAX_ONE; } Answer.Length = (Answer.BigNum[Length] == 1) + Length; return Answer; } x86_64 operator *(x86_64 A, int B) { int Length = A.Length; int Carry = 0; x86_64 Answer; for (int i = 0; i < Length + 1; i++) { Answer.BigNum[i] = (A.BigNum[i] * (ll)B + Carry) % MAX_ONE; Carry = (A.BigNum[i] * (ll)B + Carry) / MAX_ONE; } int Index = 0; while (Answer.BigNum[Index] != 0) { Index++; } Answer.Length = Index; return Answer; } x86_64 dp[maxn][2]; int main() { int N, K; scanf("%d %d", &N, &K); dp[1][1] = K - 1; for (int i = 2; i <= N; i++) { dp[i][0] = dp[i - 1][1]; dp[i][1] = dp[i - 1][0] + dp[i - 1][1] * (K - 1); } print(dp[N][0] + dp[N][1]); putchar('\n'); return 0; } |
WHY WA#6?HERE IS MY CODE!!THANK!!!! | CHIDEMYAN SERGEY | 1012. K-ичные числа. Версия 2 | 21 апр 2022 18:09 | 12 |
#include<iostream.h> #include<stdio.h> int main() { int n,i,k;unsigned __int64 a[2000],p; cin>>n>>k;a[1]=k-1;a[2]=k*(k-1); for(i=3;i<=n;i++) {a[i]=(k-1)*(a[i-1]+a[i-2]);p=a[i];} if(n==1) cout<<k-1; else if(n==2) cout<<k*(k-1); else if(n>=3) printf("%I64u", p); return 0; } Edited by author 10.04.2007 21:30 Edited by author 10.04.2007 21:31 Edited by author 10.04.2007 21:32 I have no idea!I have submit 3 times I WA at test 6 !My Good! I have no idea!I have submit 3 times My AC code for input 10 170 gives 20035832260288179816689 Compare this to the max value of unsigned __int64: 18446744073709551615 Yeah, in this problem the answer can be bigger than int64. Use high precision instead, or Java. "我操!高精度?" What?! Edited by author 14.12.2011 12:24 Edited by author 14.12.2011 12:24 Edited by author 14.12.2011 12:24 "我操!高精度?" What?! Edited by author 14.12.2011 12:24 Edited by author 14.12.2011 12:24 Edited by author 14.12.2011 12:24 It means "F*CK! High precision?" It's not just High precision! Easy : 6 8 2 6 4 1 3 means 3146286 Hard : 286 146 3 means 3146286 |
TLE on Test Case 2 | Jyotirmay Nag | 1083. Факториалы!!! | 21 апр 2022 10:13 | 1 |
#include<bits/stdc++.h> using namespace std; int main() { int n; int mul = 1; string s; cin>>n>>s; int k = s.size(); if(n%k==0){ int in = n; int temp = k; while(1){ mul = mul*in; in = in - k; if(in==k){ mul*=in; break; } } } else{ int in = n; while(1){ mul = mul*in; in = in - k; if(in==(n%k)){ mul*=in; break; } } } cout<<mul<<endl; return 0; } What is test case 2? |
Why can the Author do trick on me | DarksideCoder | 2093. Все дороги ведут в сугроб | 21 апр 2022 05:10 | 1 |
WA5,and never get Accept without High Eps.It isn't a good Problem. |