QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#413934 | #4. Gap | zeta7532 | 0 | 1ms | 5804kb | C++17 | 661b | 2024-05-18 12:35:35 | 2024-05-18 12:35:36 |
answer
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
long long findGap(int T, int N)
{
vector<ll> A;
ll l,r;
MinMax(0,1000000000000000000,&l,&r);
A.push_back(l),A.push_back(r);
N--;
rep(i,N){
ll j=i+1;
ll a,b;
ll x=l+((r-l)/N)*i+(((r-l)%N)*i)/N;
ll y=l+((r-l)/N)*j+(((r-l)%N)*j)/N-1;
MinMax(x,y,&a,&b);
if(a!=-1) A.push_back(a);
if(b!=-1) A.push_back(b);
}
sort(all(A));
A.erase(unique(all(A)),A.end());
ll ans=0;
rep(i,N-1) ans=max(ans,A[i+1]-A[i]);
return ans;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3984kb
input:
1 2 29659227736649406 728704890713443211
output:
0 2
result:
wrong answer returned 0 but expected 699045662976793805
Subtask #2:
score: 0
Wrong Answer
Test #33:
score: 0
Wrong Answer
time: 1ms
memory: 5804kb
input:
2 2 78103569500113815 605712887753065418
output:
0 5
result:
wrong answer returned 0 but expected 527609318252951603