|
|
Common BoardTRY THIS ONE 6 7 1 2 3 2 3 4 3 4 3 1 3 4 4 5 33 5 6 3 4 6 -2 IMPOSSIBLE Edited by author 27.04.2021 21:36 Edited by author 27.04.2021 21:37 ........ .B.B...B ....W... .B.B.B.. ........ .B.B.B.. ........ ........ ans:1 ..W.W... .B.B.B.. ........ .B.B.B.. ........ .B.B.B.. ........ ........ ans:2 ..W.W... .B.B.B.. W.W.W.W. .B.B.B.. W.W.W.W. .B.B.B.. ..W.W... ........ ans:6 input: 3 1 3 2 2 3 1 output: 1 3 2 " along one of the sides of the playing board" should be removed since it gives the impression that you can only move tiles next to the edges of the board. For more clarity it could say that you can move them parallel to one side of the board, or that you can shift up to four tiles as permitted by the empty square. 2 2 2 2 1 1 6 7 1 7 D U R U --- 1 3 3 2 3 2 1 2 1 7 1 9 8 7 5 4 L D U R U R L L U ----- 8 Thanks for the tests! :) They're not formatted correctly though, here are the valid ones: 2 2 2 2 1 1 6 7 1 7 DU RU --- 1 3 3 2 3 2 1 2 1 7 1 9 8 7 5 4 LDU RUR LLU ----- 8 read(p,q); for i:=2 to 10000000 do begin a:=i/100*p; b:=i/100*q; a1:=trunc(a); b1:=trunc(b); if (b1-a1)>=0.99 then begin write(i); halt; end; end; why WA ? Me,too! Edited by author 24.04.2021 19:44 The limits on the number of hailstones k (1 ≤ k ≤ 100) is not specified. use sqrt(2.00) instead of 1.41421356 This will make your program accepted. I've tried it. This probably helps 3 1 0 0 2 2 3 3 1 3 Ans: YES 3 1 0 5 2 5 3 5 1 2 Ans: NO What can it be?(tests or ideas, something pls) passes 3 0 1 1 1 2 0 1 1 2 ans: 0 but still WA Edited by author 20.04.2021 00:52 try 5 0 1 1 1 2 1 3 0 1 0 4 1 4 0 4 4 0 0 2 2 0 try this one input: 3 2 61 62 5 75 20 85 50 61 3 10 20 30 1 5 output: 5 4 3 75 85 20 2 61 62 5 75 20 85 50 61 3 10 20 30 3 30 20 85 Will answer include 75 or not? 50 61 62 85 Why 75 does not fall into answer? Because no shortest route from 30 to 75 begins with 30,20,85 30->20->85->75 is one. Because no shortest route from 30 to 75 begins with 30,20,85 30->20->75 is shortest not your one Edited by author 20.04.2021 14:07 Edited by author 20.04.2021 14:07 My solution in Python 3 took 0.062s and 220 KB. Can it be faster? Of course it can! my solution took away just 0.001 sec and 172 kB(in C) Python takes more time than lower level languages and thats why it's not the best idea to use it in a speed based setting just a binary search over overspeeding object Election1263 extends App { val Array(n, m) = scala.io.StdIn.readLine().split(" ").map(_.toInt) val list = (0 to m - 1).foldLeft(List.empty[Int]){case (acc, _) => scala.io.StdIn.readLine().split("\n").map(_.toInt).toList match { case head :: Nil => acc :+ head case _ => acc } } val electionList = list.groupBy(identity).foldLeft(List.empty[Int]) {(s, e) => s :+ e._2.size } def getPersent(list: List[Int], list1: List[Double]) : List[Double] = list match { case head :: tail => getPersent(tail, list1 :+ head * 100.0 / m) case head :: Nil => getPersent(Nil, list1 :+ head * 100.0 / m) case _ => list1 } val result = getPersent(electionList, List()) result.foreach(e => println("%.2f".format(e) + "%") ) } #include <iostream> #include <vector> #include <cmath> #include <string> #include <stack> using namespace std; string solve(string text) { string ts, cs = "", ans = ""; int i = 0; while (i < text.size()) { while(int(text[i]) >= 65 && int(text[i]) <= 122) { ts = ""; // create temp string ts.push_back(text[i]); // translate char to string cs.insert(0, ts); //reverse string i++; } if (i > 0 && int(text[i-1]) >= 65 && int(text[i-1]) <= 122) { ans += cs; //plus to out ans cypher word cs = ""; // make cypher word "" }
ans+=text[i]; i++; } ans += char(0x20); ans += char(0x0a); return ans; } int main() { string s; while(getline(cin, s)) cout << solve(s); } What can it be, please? WA2 5 0 1 1 0 2 1 1 3 1 1 4 1 2 3 2 4 3 ans: 3 2 5 1 0 1 2 0 1 3 1 1 4 1 1 2 2 3 4 3 ans: 3 2 3 2 1 1 0 2 1 3 0 0 0 1 1 1 ans: 0 2 0 5 0 1 1 0 2 2 1 3 3 1 4 1 2 2 3 4 3 6 4 ans: 6 4 8 0 1 1 0 2 1 2 3 1 3 4 1 0 5 1 5 6 1 6 7 1 6 7 7 1 4 4 4 4 3 3 4 7 0 ans: 0 4 0 1 1 3 5 0 1 1 1 2 1 3 0 1 0 4 1 4 0 4 4 0 0 2 2 0 ans: 1 1 2 2 Edited by author 17.04.2021 20:29 Edited by author 17.04.2021 20:50 Edited by author 20.04.2021 00:30 Edited by author 20.04.2021 00:41 Edited by author 20.04.2021 23:06 |
|
|