QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#632210 | #4096. 코딩 테스트 | C1942huangjiaxu | 0 | 0ms | 3696kb | C++14 | 1.1kb | 2024-10-12 12:57:36 | 2024-10-12 12:57:37 |
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+9;
typedef long long ll;
int n,m,a[N],b[N];
ll sa[N],sb[N];
bool check(int l,int r,int d){
for(int i=l;i<=r;++i)for(int j=i;j<=r;++j)if(1ll*d*(j-i+1)-(sa[j]-sa[i-1])>sb[j+1]-sb[i-1])return false;
return true;
}
vector<int> testset(vector<int> A, vector<int> B, vector<int> L, vector<int> U){
n=A.size(),m=L.size();
for(int i=1;i<=n;++i)a[i]=A[i-1];
for(int i=2;i<=n;++i)b[i]=B[i-2];
for(int i=1;i<=n+1;++i)sa[i]=sa[i-1]+a[i],sb[i]=sb[i-1]+b[i];
vector<int>ans(n);
for(int i=0;i<m;++i){
int l=0,r=2e8;
while(l<r){
int mid=l+r+1>>1;
if(check(L[i]+1,U[i]+1,mid))l=mid;
else r=mid-1;
}
ans[i]=l;
}
return ans;
}
/*
int main(){
freopen("a.in","r",stdin);
freopen("a.out","w",stdout);
scanf("%d%d",&n,&m);
vector<int>A(n),B(n-1),L(m),U(m);
for(int i=0;i<n;++i)scanf("%d",&A[i]);
for(int i=0;i<n-1;++i)scanf("%d",&B[i]);
for(int i=0;i<m;++i)scanf("%d%d",&L[i],&U[i]);
vector<int>ans=testset(A,B,L,U);
for(int i=0;i<m;++i)printf("%d\n",ans[i]);
return 0;
}*/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3696kb
input:
2 1 746 733 619 0 1
output:
Wrong input
result:
wrong answer 1st lines differ - expected: 'e4bc1609-b8fd-4286-b31c-e5e8e5765738', found: 'Wrong input'
Subtask #2:
score: 0
Time Limit Exceeded
Test #11:
score: 0
Time Limit Exceeded
input:
100000 100 19808256 24285218 35700559 40271678 34848402 69357487 68150704 33167327 11009744 51263605 95965914 99915162 98938894 25021047 41422333 21862896 68096319 74258633 12048507 49456137 34627666 2028097 39447833 88604280 58491153 12515029 84711345 70929241 88589416 4246292 47068575 45272978 203...
output:
Unauthorized output
result:
Subtask #3:
score: 0
Time Limit Exceeded
Test #31:
score: 0
Time Limit Exceeded
input:
5000 100000 93608251 16211038 93349835 94727166 27749929 28580474 39398397 58978075 32539760 49630110 14330110 62149976 63372420 45530888 44815920 40624609 4942456 35245376 9509556 17318048 91459277 83937735 82541206 16905922 22994630 56339982 33531160 45581398 67402358 51369287 2786263 53237145 830...
output:
Unauthorized output
result:
Subtask #4:
score: 0
Time Limit Exceeded
Test #51:
score: 0
Time Limit Exceeded
input:
100000 100000 8220608 27643636 9653375 7527483 4568995 4937547 27001430 10512886 14865249 54452685 31213146 1223559 25266797 9367382 5798933 1485258 33036920 2988776 5046089 41823731 6136379 20608943 10327625 90179994 75745370 21933251 3376845 19790905 52189711 21570452 18938610 18445540 26257950 24...
output:
Unauthorized output
result:
Subtask #5:
score: 0
Skipped
Dependency #1:
0%