Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

MARATHON - The Marathon Movement

Every year in september the Einstein-Marathon in Ulm takes place. At the beginning of the race the participants should line up at the start area in accordance with their expected finish time. It's clear that this will make everyone's life easier. There's nothing more frustrating for the quicker runners to be dodging other people at the start and nothing more demoralising for the slower runners than being overtaken by hundreds of quicker runners. Unfortunately there are always people who overestimate their performance by far and start in front of the field. So many overtakings will happen during the race. The organizers of the marathon want to know how many overtakings have at least happend during the race and ask you for help. They have a file which lists the starting number of each runner according to the time they crossed the starting line. A second is ordered according the time they crossed the finishing line.

[Abbildung Marathonstart]

Input

The first line contains the number of marathons t (t<100). Each marathon is specified by three lines. The first line contains the number of runners n (1<n≤40000). The second line is a permutation of the starting numbers 1,...,n which represents the order in which the runners passed the starting line. Finally the third line a permutation which represents the finishing order.

Output

For each marathon output one line which contains the minimal number of overtakings that have happend during the race. See the sample output for the detailed format.

Example

Input:
3
5
1 2 4 3 5 
1 2 3 4 5 
6
2 3 4 5 6 1 
1 2 3 4 5 6 
7
7 6 5 4 3 2 1 
1 2 3 4 5 6 7 


Output:
at least 1 overtaking(s)
at least 5 overtaking(s)
at least 21 overtaking(s)


Added by:Simon
Date:2007-04-29
Time limit:4.300s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C CSHARP C++ 4.3.2 CPP C99 CLOJURE LISP sbcl LISP clisp D ERL FSHARP FORTRAN GO HASK JAVA JS-RHINO LUA OCAML PERL PERL6 PHP PRLG-swi PYTHON PYTHON3 PY_NBC RUBY SCALA
Resource:Ulm Algorithm Course SoSe 2007

hide comments
2013-11-04 10:54:01 Gunnar Völkel
Wenn ihr Probleme diskutieren wollt, nehmt besser das Forum im Rubikon. Da bekommen wir Hinweisemails, dass etwas gepostet wurde, was hier in SPOJ nicht der Fall ist.
2013-11-04 06:37:53 Thomas Huffert
@Lisa @Stefan habe dasselbe Problem. Alle Testcases von Marathon.in sind in um 2 Sekunden durch, aber hier timelimit exceeded? Ideone.com mit selbiger Warnmeldung.
2013-11-04 03:24:38 Lisa Maile
Ich schließe mich Stefan an. Mein Programm benötigt (auf meinem alten RanzPC!!) 3,1 sec für alle Testfälle von marathon.in.

Aber Fehlermeldung: time limit exceeded
Auf Ideone.com: standartinput und output seien leer.

Deswegen muss sich mein Tutor das jetzt nochmal extra anschauen, nachdem ich das Zeug jetzt noch kommentiere?

Ein bisschen für dumm verkauft fühlt man sich da schon und etwas mehr Support in dem Forum wäre auch klasse!

Dennoch jetzt schonmal ein fettes Danke an meinen Tutor! :-P
2013-11-03 15:29:25 Stefan Scheible
Hallo!
Mein Marathon-Programm (Java) arbeitet in Eclipse einwandfrei, es liest alle Testdaten von system.in, und schreibt die richtigen Ergebnisse nach system.out - hab es viele Male erfolgreich getestet. Hier im SPOJ wird es aber wegen "Time Limit exceeded" nicht angenommen, und bei "Run" sehe ich folgende Fehlermeldungen:
Standard input is empty
sowie
Standard output is empty

Muss ich was Besonderes beachten, um die Ein-/Ausgabe der Daten im SPOJ hinzukriegen?

Verwende die üblichen Methoden in Java, um von der Konsole zu lesen:

InputStreamReader input = new InputStreamReader(System.in);
BufferedReader reader = new BufferedReader(input);
String line = reader.readLine();

Schon dieses allererste readLine in meinem Programm, das in Eclipse mit einer beliebigen Zahl als Testeingabe (= Anzahl der Testläufe) einwandfrei funktioniert, scheint in SPOJ eine null-Zeile zurückzuliefern, d.h. das Programm bekommt in SPOJ offensichtlich erst gar keine Konsol-Eingabe und läuft somit erst gar nicht wirklich los.

Last edit: 2013-11-03 16:21:06
2013-10-30 15:25:57 Dominik Könke
Nein ist sie nicht. Lies dir die Aufgabenstellung nochmal durch.
2013-10-29 20:12:16 Cezary Patzelt
ist die dritte zeile immer 1-n?

also wie hier oben
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.