# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
173742 | 2020-01-05T09:27:24 Z | Ruxandra985 | ICC (CEOI16_icc) | C++14 | 222 ms | 632 KB |
#include <bits/stdc++.h> #include "icc.h" using namespace std; int f[110] , w[110] , a[110] , b[110]; pair <int,int> idk[110]; void run (int n){ int i , cc , st , dr , mid , aux , p , q , l , r , elem; for (i=1;i<=n;i++) f[i] = i; for (int mc = 1 ; mc < n ; mc++){ /// vreau sa ma duc in jos cat pot pana gasesc intervalul care contine capetele while (true){ /// o sa fac solutia aia mai proasta cu generat random pt ca nuj cum altcumva for (i=1;i<=n - mc + 1;i++){ idk[i] = make_pair(rand() , i); } sort (idk + 1 , idk + n - mc + 1 + 1); p = q = 0; for (cc = 1 ; cc <= (n - mc + 1) / 2 ; cc++){ for (i=1;i<=n;i++){ if (f[i] == idk[cc].second) a[p++] = i; } } for (cc = (n - mc + 1) / 2 + 1 ; cc <= n - mc + 1 ; cc++){ for (i=1;i<=n;i++){ if (f[i] == idk[cc].second) b[q++] = i; } } if (query( p , q , a , b ) == 1){ /// un capat de muchie e intr o jumatate , celalalt capat in cealalta break; } else { /// ambele capete sunt in aceeasi jum continue; } } /// ai vectorii a si b /// a are p elem si b are q /// a si b sunt indexate de la 0 /// pt a while (p > 1){ if (query (p / 2 , q , a , b) == 1) p/=2; else { for (i = p/2 ; i < p ; i++) a[i - p/2] = a[i]; p = p - p / 2; } } /// pt b while (q > 1){ if (query (p , q / 2 , a , b) == 1) q/=2; else { for (i = q/2 ; i < q ; i++) b[i - q/2] = b[i]; q = q - q / 2; } } setRoad(a[0] , b[0]); /// acum trebuie sa modificam f ul int u1 = min( f[a[0]] , f[b[0]] ); int u2 = max( f[a[0]] , f[b[0]] ); for (i=1;i<=n;i++){ if (f[i] == u2) f[i] = u1; else if (f[i] == n - mc + 1 && u2 != n - mc + 1) f[i] = u2; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 504 KB | Ok! 110 queries used. |
2 | Correct | 9 ms | 504 KB | Ok! 97 queries used. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 41 ms | 504 KB | Ok! 548 queries used. |
2 | Correct | 63 ms | 568 KB | Ok! 835 queries used. |
3 | Correct | 60 ms | 552 KB | Ok! 806 queries used. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 146 ms | 504 KB | Ok! 1506 queries used. |
2 | Correct | 222 ms | 632 KB | Ok! 2172 queries used. |
3 | Correct | 159 ms | 596 KB | Ok! 1653 queries used. |
4 | Correct | 164 ms | 564 KB | Ok! 1687 queries used. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 169 ms | 504 KB | Ok! 1690 queries used. |
2 | Correct | 163 ms | 504 KB | Ok! 1657 queries used. |
3 | Correct | 186 ms | 504 KB | Ok! 1877 queries used. |
4 | Correct | 154 ms | 504 KB | Ok! 1607 queries used. |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 189 ms | 504 KB | Too many queries! 1907 out of 1775 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 190 ms | 504 KB | Too many queries! 1900 out of 1625 |
2 | Halted | 0 ms | 0 KB | - |