# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
40880 |
2018-02-09T16:08:06 Z |
IvanC |
Gap (APIO16_gap) |
C++14 |
|
91 ms |
2660 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
mt19937_64 gen(rand() ^ (rand() << 16));
typedef long long ll;
typedef pair<ll,ll> ii;
ll NN,TT,maior;
ii binary_search(ll ini,ll fim){
if(ini == fim) return ii(ini,ini);
ll copia1 = ini,copia2 = fim;
MinMax(ini,fim,&copia1,&copia2);
ini = copia1;
fim = copia2;
if(fim - ini <= maior) return ii(ini,fim);
ll meio = ini + (gen() % (fim - ini));
ii novo1 = binary_search(ini,meio);
ii novo2 = binary_search(meio+1,fim);
if(novo1.second != novo2.first) maior = max(maior, novo2.first - novo1.second);
return ii(ini,fim);
}
ll findGap(int T,int N){
TT = T;
NN = N;
ll ini = 0,fim = (ll)1e18;
if(T == 1){
vector<ll> vetor;
for(ll qtd = N;qtd >= 1;qtd -= 2){
ll copia1,copia2;
MinMax(ini,fim,&copia1,&copia2);
vetor.push_back(copia1);
vetor.push_back(copia2);
ini++,fim--;
}
sort(vetor.begin(),vetor.end());
for(ll i = 0;i+1<vetor.size();i++) maior = max(maior, vetor[i+1] - vetor[i] );
return maior;
}
binary_search(ini,fim);
return maior;
}
Compilation message
gap.cpp: In function 'll findGap(int, int)':
gap.cpp:35:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(ll i = 0;i+1<vetor.size();i++) maior = max(maior, vetor[i+1] - vetor[i] );
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
480 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
488 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
492 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
652 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
652 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
652 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
652 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
652 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
652 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
652 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
652 KB |
Output isn't correct |
13 |
Incorrect |
2 ms |
652 KB |
Output isn't correct |
14 |
Incorrect |
2 ms |
652 KB |
Output isn't correct |
15 |
Incorrect |
2 ms |
652 KB |
Output isn't correct |
16 |
Incorrect |
16 ms |
1132 KB |
Output isn't correct |
17 |
Incorrect |
13 ms |
1132 KB |
Output isn't correct |
18 |
Incorrect |
11 ms |
1132 KB |
Output isn't correct |
19 |
Incorrect |
11 ms |
1164 KB |
Output isn't correct |
20 |
Incorrect |
9 ms |
1264 KB |
Output isn't correct |
21 |
Incorrect |
42 ms |
2532 KB |
Output isn't correct |
22 |
Incorrect |
40 ms |
2584 KB |
Output isn't correct |
23 |
Incorrect |
40 ms |
2584 KB |
Output isn't correct |
24 |
Incorrect |
40 ms |
2640 KB |
Output isn't correct |
25 |
Incorrect |
38 ms |
2640 KB |
Output isn't correct |
26 |
Incorrect |
45 ms |
2640 KB |
Output isn't correct |
27 |
Incorrect |
40 ms |
2640 KB |
Output isn't correct |
28 |
Incorrect |
50 ms |
2660 KB |
Output isn't correct |
29 |
Incorrect |
49 ms |
2660 KB |
Output isn't correct |
30 |
Incorrect |
39 ms |
2660 KB |
Output isn't correct |
31 |
Correct |
2 ms |
2660 KB |
Output is correct |
32 |
Correct |
2 ms |
2660 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
2660 KB |
Partially correct |
2 |
Partially correct |
1 ms |
2660 KB |
Partially correct |
3 |
Partially correct |
1 ms |
2660 KB |
Partially correct |
4 |
Partially correct |
1 ms |
2660 KB |
Partially correct |
5 |
Partially correct |
1 ms |
2660 KB |
Partially correct |
6 |
Partially correct |
1 ms |
2660 KB |
Partially correct |
7 |
Partially correct |
2 ms |
2660 KB |
Partially correct |
8 |
Partially correct |
2 ms |
2660 KB |
Partially correct |
9 |
Partially correct |
2 ms |
2660 KB |
Partially correct |
10 |
Partially correct |
2 ms |
2660 KB |
Partially correct |
11 |
Partially correct |
2 ms |
2660 KB |
Partially correct |
12 |
Partially correct |
3 ms |
2660 KB |
Partially correct |
13 |
Partially correct |
2 ms |
2660 KB |
Partially correct |
14 |
Partially correct |
2 ms |
2660 KB |
Partially correct |
15 |
Partially correct |
3 ms |
2660 KB |
Partially correct |
16 |
Partially correct |
14 ms |
2660 KB |
Partially correct |
17 |
Partially correct |
13 ms |
2660 KB |
Partially correct |
18 |
Partially correct |
14 ms |
2660 KB |
Partially correct |
19 |
Partially correct |
14 ms |
2660 KB |
Partially correct |
20 |
Partially correct |
21 ms |
2660 KB |
Partially correct |
21 |
Partially correct |
48 ms |
2660 KB |
Partially correct |
22 |
Partially correct |
47 ms |
2660 KB |
Partially correct |
23 |
Partially correct |
48 ms |
2660 KB |
Partially correct |
24 |
Partially correct |
68 ms |
2660 KB |
Partially correct |
25 |
Partially correct |
91 ms |
2660 KB |
Partially correct |
26 |
Partially correct |
50 ms |
2660 KB |
Partially correct |
27 |
Partially correct |
48 ms |
2660 KB |
Partially correct |
28 |
Partially correct |
60 ms |
2660 KB |
Partially correct |
29 |
Partially correct |
46 ms |
2660 KB |
Partially correct |
30 |
Partially correct |
50 ms |
2660 KB |
Partially correct |
31 |
Partially correct |
2 ms |
2660 KB |
Partially correct |
32 |
Correct |
2 ms |
2660 KB |
Output is correct |