Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had misunderstood rules, i had to take every closest flight that is possible...</p> <pre><code>// lets find all airports which allows flights from home city and so on.. int min;// minimum value int minc;// minimal coordinate int mine;//real position of edge in array int fakehome = 0;// temprorary position for house int lastmine = -1;//last position, so can compare times //cout &lt;&lt; timeToInt(begintime); cout &lt;&lt; home &lt;&lt; " " &lt;&lt; begintime&lt;&lt; endl; fout &lt;&lt; home &lt;&lt; " " &lt;&lt; begintime&lt;&lt; endl; while(home != aim)// loop while we havent reached aim/target airport { min = 1440;// 24(hours) * 60 is unreachable value, so 1440 minuts ok minc = ports;// max could be count(of airports) mine = edges_counter;// array position of edge //lastmine = -1; for(int i =0;i&lt; edges_counter;i++) { //if(edges[i][0] == home) cout &lt;&lt; edges[i][0] &lt;&lt; " " &lt;&lt; edges[i][1] &lt;&lt; " " &lt;&lt; edges[i][2] &lt;&lt; " " &lt;&lt; edges[i][3] &lt;&lt; " " &lt;&lt; endl; if(min &gt; edges[i][2] &amp;&amp; edges[i][0] == home &amp;&amp; edges[i][4] == 0) { if(lastmine != -1 &amp;&amp; (edges[lastmine][2]+edges[lastmine][3]) &lt; edges[i][2]) { min = edges[i][2]; minc = edges[i][1]; mine = i; fakehome = edges[i][1]; } else if(lastmine == -1 &amp;&amp; timeToInt(saklaiks) &lt; edges[i][2]) { min = edges[i][2]; minc = edges[i][1]; mine = i; fakehome = edges[i][1]; } } } if(mine != edges_counter) { //cout &lt;&lt; setw(3) &lt;&lt; mine &lt;&lt; " "; intToTime(edges[mine][2],time); cout &lt;&lt; home &lt;&lt; "-&gt;" &lt;&lt; fakehome &lt;&lt; " " &lt;&lt; time; fout &lt;&lt; home &lt;&lt; "-&gt;" &lt;&lt; fakehome &lt;&lt; " " &lt;&lt; time; intToTime((edges[mine][2]+edges[mine][3]), time); cout &lt;&lt; "-" &lt;&lt; time&lt;&lt; endl; fout &lt;&lt; "-" &lt;&lt; time&lt;&lt; endl; intToTime((edges[mine][2]+edges[mine][3]),begintime); home = fakehome; edges[mine][4] = 1; } lastmine = mine; } </code></pre> <p>But there is one problem..</p> <p>If </p> <p>infinite loop is given for the flights and cant reach goal. How to check it?</p> <pre><code>If is given 3 (how much airports) 1 3 (have to go from 1 to 3) 00:00 (start time) 1 2 01:00-02:00 (from 1 to 2 there is flight that takes 1 hour) 2 1 03:00-04:00 (from 2 to 1 there's also flight that takes 1 hour) 2 3 12:00-13:00 (...) </code></pre> <p>But 2->3 is never reached due to 2->1 flight being faster that 2->3 any idea knowing loop before printing first elements, cause it is printing like</p> <pre><code>1-&gt;2 ... 2-&gt;1 ... 1-&gt;2 ... </code></pre> <p>and so on.. I have to print : "Impossible".</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload