|
|
Common BoardTest 16 contains the special case, where n = k = 1. The answer is obviously 0.000000. I don't understand why the author has put this special case on test 16, I didn't ever think, that it could be a special case. It rather costs me lots of time to debug. ... then maybe you misread the statement: 1. Pins have diameter 1, not 0 2. You should output diameter of the ball, not radius Thank you! And it's really interesting that you know exactly how stupid I am. Edited by author 28.11.2014 22:25 Если двухкомнатная квартира стоит нечётную стоимость, как делится её цена? As like as for even cost. Если была стоимость 5, то каждый платит по 2,5. Если бы делилось как четное, то будет WA18 - проверено. Так что считайте, что могут не целые числа. Edited by author 28.11.2014 01:41 Edited by author 28.11.2014 01:41 ababa ababab if you use kmp, you should pay attention when your index for the first word round up. It takes hours to find the problem. As to me, the problem was with special symbols. In this test end of the first line was defined by two symbols (like Windows style: 10 and 13). I can not solve it,please tell me how to solve it,thank you!^_^ You can do this for all edges: 1 - delete edge 2 - find shortest way (Deikstra) between 2 vertex, which are connetcted with this edge 3 - insert edge This solution (O(N^4))pass time limits P.S. It may done in N^3 with Deikstra for each vertex I don't know how to do this :( Is there anything to do with Hamiltonian circuit ? Hamiltonian circuit for n=100 ?!?!?! We will die before your program will give us an answer :O Well... it's not always true that Hamiltonian related problems are NP completed. You can always use some heuristics that will reduce it to polynomial time... so don't be so marked ^^ Does anyone know test no. 5? Are there any tricks? Pls HELP me!!! Radius of the bomb can be less than radius of the town. Edited by author 05.04.2006 23:10 Edited by author 05.04.2006 23:10 Подскажите какие могут быть ошибки Please help me Edited by author 26.11.2014 19:59 Edited by author 26.11.2014 19:59 Edited by author 13.01.2015 16:12 a = input() b = input() a = int(a) b = int(b) c = a+b print c
this should be correct isn't it ? It is correct in Python 2, though explicit cast is excessive. In Python 3, use should add brackets after 'print'. import java.io.IOException; import java.util.Scanner; public class chess { static Scanner scn = new Scanner(System.in); public static void main(String args[]) throws IOException{ int n=scn.nextInt(); int[] g = new int[n]; for (int i=0; i<n; i++){ g[i]=game(i);
} System.out.println(""); for (int i=0; i<n; i++){ System.out.println(g[i]);
} } private static int game(int q) throws IOException{ int b = 0, c, f=0; b=count(b); c=scn.nextInt(); if (b-1>0 && c-2>0 && b-1<=8 && c-2<=8) f++; if (b+1>0 && c+2>0 && b-1<=8 && c-2<=8) f++; if (b+1>0 && c+2>0 && b+1<=8 && c+2<=8) f++; if (b-1>0 && c-2>0 && b+1<=8 && c+2<=8) f++; if (c+1>0 && b-2>0 && c+1<=8 && b-2<=8) f++; if (c-1>0 && b+2>0 && c-1<=8 && b+2<=8) f++; if (c+1>0 && b-2>0 && c-1<=8 && b+2<=8) f++; if (c-1>0 && b+2>0 && c+1<=8 && b-2<=8) f++; return f;
} private static int count(int x) throws IOException{ char cd; cd = (char) System.in.read(); if (cd=='a') x=1; if (cd=='b') x=2; if (cd=='c') x=3; if (cd=='d') x=4; if (cd=='e') x=5; if (cd=='f') x=6; if (cd=='g') x=7; if (cd=='h') x=8; return x;
} } done... Edited by author 30.11.2014 01:32 Edited by author 30.11.2014 01:32 you can use Fenwick tree It's more useful. Edited by author 25.11.2014 17:00 plz daite neskolko primerov I can't understand my mistake. If you have any test give me please!!!. Try one of these tests. I'm sure, your program gets 'No' on exactly one of them: 6 4 4 4 4 2 4 1 5 3 3 3 3 6 2 4 2 2 2 2 3 3 3 3 1 5 answer: 6 4 4 4 4 2 4 1 5 3 3 3 3 Yes 1 4 2 5 3 6 6 2 4 2 2 2 2 3 3 3 3 1 5 Yes 4 1 5 2 6 3 Do you use some greedy strategy? #include <algorithm> #include <stdio.h> #include <set> using namespace std; #define _1 first #define _2 second #define mk make_pair typedef pair<int, int> PII; typedef pair<int, PII> PIII; bool cmp(PIII a, PIII b){ return a._2._1 != b._2._1 ? a._2._1 > b._2._1 : a._1 > b._1; } const int maxn = 100005; PIII a[maxn]; PII b[maxn]; int res[maxn], endres; int main(){ int n,q; set<PII>myset; scanf("%i",&n); endres = n - 1; for(int i = 0; i < n; i ++){ scanf("%i %i",&a[i]._1, &a[i]._2._1); a[i]._2._2 = i + 1; } sort(a,a + n, cmp); res[endres] = a[n - 1]._2._2; b[endres] = mk(a[n - 1]._1, a[n - 1]._2._1); endres --; for(int i = n - 2; i >= 0; i --){ if(!myset.empty()){ set<PII> :: iterator it; it = myset.lower_bound(mk(a[i]._1, 1000001)); while(it != myset.end() && (*it)._1 == a[i]._1) it --; if(it != myset.end()){ PII pr = *it; //printf("%i\n", (*it1).second) res[pr._2] = a[i].second.second; b[pr._2] = mk(a[i]._1, a[i]._2._1); myset.erase(it); continue; } } if(res[endres + 1] == 0 || b[endres + 1]._1 != a[i]._2._1){ res[endres] = a[i]._2._2; b[endres] = mk(a[i]._1,a[i]._2._1); }else { myset.insert(mk(a[i]._2._1, endres)); endres --; res[endres] = a[i]._2._2; b[endres] = mk(a[i]._1,a[i]._2._1); } endres --; } if(myset.empty()){ puts("Yes"); for(int i = 0; i < n; i ++) printf("%i ",res[i]); } else puts("No"); return 0; } can you give me any test for this code. I have got WA# 4 5 2 2 2 2 3 3 3 3 1 4 Your answer: No Correct answer: Yes, 3 1 5 4 2 Could someone tell me how to input double fast in C++ ? scanf is not fast enough Edited by author 25.11.2014 08:55 10+1 + 5+1 + 2 = 19. And there is no other way 10+1+5+1=17 So what happens with the person with time 2? How is that possible? M stands for mine detector. 1 2 5 10 M - empty 2 5 - 1 10 M (+10) 1 2 5 M - 10 (+1) 2 - 1 5 10 M (+5) 1 2 M - 5 10 (+1) empty - 1 2 5 10 (+2) 10 + 1 + 5 + 1 + 2 = 19 Which is 19, not 17. That's why we are asking how can it be 17? 1 2 5 10 | --- = 0 5 10 | 1 2 = 2 1 5 10 | 2 = 3 1 | 5 10 2 = 13 1 2 | 5 10 = 15 --- | 1 2 5 10 = 17 You can use DFS find the tips as this. [code deleted] Edited by moderator 19.11.2019 22:57 Hi, I had wrong answer on test 9. Then I found an error and got the problem accepted. My test may be useful: 1000 1000 1 1 2 1 1 2 50 50 1 10 10 11 10 10 11 69.392 0.343 sec. Just to let you know. ;) Heh, 0.35 sec... Mine is O(N^4) and 0.078 |
|
|