QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#887202 | #10050. Bitaro the Brave 2 | modwwe | 0 | 6ms | 10264kb | C++23 | 2.6kb | 2025-02-07 15:40:36 | 2025-02-07 15:40:41 |
Judging History
answer
#pragma GCC optimize("Ofast,unroll-loops")
#include<bits/stdc++.h>
#define int long long
#define ll long long
#define down cout<<'\n';
#define debug cout<<" cucuucucuuu",down
#define NHP ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
#define modwwe int t;cin>>t; while(t--)
#define bit(i,j) (i>>j&1)
#define sobit(a) __builtin_popcountll(a)
#define task2 "ftree"
#define task "test"
#define fin(x) freopen(x".inp","r",stdin)
#define fou(x) freopen(x".out","w",stdout)
#define pb push_back
#define mask(k) (1<<k)
#define mp make_pair
#define checktime cerr << (double)clock() / CLOCKS_PER_SEC * 1000 << " ms";
using namespace std;
#define getchar_unlocked getchar
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l,int r)
{
return uniform_int_distribution<int>(l,r)(rd);
}
inline int scan()
{
char c = getchar_unlocked();
int x = 0;
while (c < '0' || c > '9')
{
c = getchar_unlocked();
}
while (c >= '0' && c <= '9')
{
x = (x << 1) + (x << 3) + c - '0';
c = getchar_unlocked();
}
return x;
}
void phongbeo();
const int inf = 1e16;
const ll mod2 = 1e9+7;
const int mod1 = 998244353;
const ll base=67;
int add(int x,int y)
{
if(x+y>=mod2) x-=mod2;
if(x+y<0)x+=mod2;
return x+y;
}
struct icd
{
long double a;
int b;
};
struct ib
{
int a;
int b;
};
struct ic
{
int a,b,c;
};
struct id
{
int a, b, c, d;
};
struct ie
{
int a, b, c, d, e;
};
int n, m, s1, s2, s4, s3, sf, k, s5, s6, mx, s7, s8, s9, mx2, res, dem2 = 0, dem = 0, s33, dem3, dem4, mid, l2, r2, center;
int i, s10, s12,k1,k2,k3,s11,lim,w,l,r ;
int kk;
int el = 19;
main()
{
if(fopen(task2".inp","r"))
{
fin(task2);
fou(task2);
}
if(fopen(task".inp","r"))
{
fin(task);
fou(task);
}
NHP
/// cin>>s1;
//modwwe
phongbeo(),down
// checktime
}
int a[200007];
int b[200007];
int t[200007];
int suff[200007];
int pre[200007];
void phongbeo()
{
cin>>n;
for(int i=1; i<=n; i++)
cin>>a[i];
for(int i=1; i<=n; i++)
cin>>b[i],b[i]+=b[i-1];
for(int i=1; i<=n; i++)
{
t[i]=a[i]-b[i-1];
}
suff[n+1]=-1e12;
pre[0]=-1e12;
for(int i=n; i>=1; --i)
suff[i]=max(suff[i+1],t[i]);
for(int i=1; i<=n; i++)
pre[i]=max(pre[i-1],t[i]);
s4=1e12+1;
for(int i=1; i<=n; i++)
{
s5=max({pre[i-1]-b[n]-b[i-1],suff[i]+b[i-1],0ll});
s4=min(s4,s5);
}
cout<<s4;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 10
Accepted
time: 0ms
memory: 9836kb
input:
2000 10 9 9 9 9 9 10 9 10 10 9 10 9 10 9 9 10 9 9 9 10 9 10 10 9 10 10 9 9 10 9 10 10 10 9 10 10 9 10 9 9 10 10 9 9 9 9 9 9 9 9 10 9 10 10 10 9 10 9 9 10 9 10 10 10 10 10 9 10 10 10 9 9 9 9 10 9 10 9 10 9 10 10 10 10 9 9 10 10 9 9 9 9 10 9 10 10 10 9 9 9 10 9 9 9 9 10 10 10 9 10 10 10 10 9 10 9 10 9...
output:
9
result:
ok single line: '9'
Test #2:
score: 10
Accepted
time: 1ms
memory: 9964kb
input:
2000 9 9 10 9 10 9 10 9 9 9 10 10 9 10 10 9 9 10 9 10 10 9 10 9 9 9 10 10 10 10 9 10 9 10 9 9 10 9 9 9 9 9 10 10 9 9 9 10 9 9 10 9 9 9 9 10 10 9 10 10 10 10 10 9 9 10 10 9 9 9 9 10 10 10 9 10 9 9 10 9 9 10 9 9 9 10 9 10 10 9 9 10 10 9 9 9 10 9 10 9 10 9 9 10 9 9 9 10 9 10 9 9 9 9 10 9 9 10 10 9 10 1...
output:
9
result:
ok single line: '9'
Test #3:
score: 10
Accepted
time: 0ms
memory: 9836kb
input:
2000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
0
result:
ok single line: '0'
Test #4:
score: 10
Accepted
time: 2ms
memory: 9744kb
input:
2000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
0
result:
ok single line: '0'
Test #5:
score: 10
Accepted
time: 0ms
memory: 9836kb
input:
2000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
0
result:
ok single line: '0'
Test #6:
score: 10
Accepted
time: 0ms
memory: 7936kb
input:
2000 8 6 6 8 8 9 7 6 8 7 10 8 6 8 9 8 10 9 10 10 6 6 10 9 7 8 9 9 7 9 6 10 6 8 6 9 8 10 10 8 9 6 10 10 7 9 10 7 7 10 9 10 10 9 9 10 7 9 8 7 7 9 6 6 9 9 9 6 7 8 8 8 10 8 7 9 10 7 9 6 8 6 6 6 10 10 8 8 9 8 7 9 8 8 10 9 7 6 7 7 7 6 8 10 6 8 9 9 10 9 10 10 7 10 9 7 9 9 6 9 10 6 7 7 10 9 8 7 9 8 8 6 9 10...
output:
10
result:
ok single line: '10'
Test #7:
score: 10
Accepted
time: 0ms
memory: 9840kb
input:
2000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
8
result:
ok single line: '8'
Test #8:
score: 10
Accepted
time: 0ms
memory: 9960kb
input:
2000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
10
result:
ok single line: '10'
Test #9:
score: 0
Wrong Answer
time: 0ms
memory: 9968kb
input:
2000 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
0
result:
wrong answer 1st lines differ - expected: '8', found: '0'
Subtask #2:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 0ms
memory: 9964kb
input:
2000 100000000 100000001 100000002 100000003 100000004 100000005 100000006 100000007 100000008 100000009 100000010 100000011 100000012 100000013 100000014 100000015 100000016 100000017 100000018 100000019 100000020 100000021 100000022 100000023 100000024 100000025 100000026 100000027 100000028 10000...
output:
99999001
result:
wrong answer 1st lines differ - expected: '99999489', found: '99999001'
Subtask #3:
score: 0
Wrong Answer
Test #27:
score: 0
Wrong Answer
time: 6ms
memory: 10264kb
input:
500000 3 4 10 8 4 3 8 10 1 7 2 5 5 4 8 6 5 9 1 6 5 7 2 9 7 1 6 7 9 6 5 3 2 5 9 8 5 9 7 6 3 8 6 4 7 4 2 1 3 7 9 5 2 10 4 6 3 5 7 7 2 1 3 1 6 7 5 6 8 7 10 6 10 8 5 9 3 4 5 7 9 2 4 2 10 2 5 1 8 1 5 1 5 6 10 7 6 4 6 3 5 9 7 1 7 10 8 8 7 2 3 4 10 3 8 4 1 6 6 1 1 7 5 9 8 1 6 2 2 5 1 1 3 3 1 3 4 1 9 1 5 6 ...
output:
3
result:
wrong answer 1st lines differ - expected: '1', found: '3'
Subtask #4:
score: 0
Runtime Error
Test #42:
score: 0
Runtime Error
input:
500000 500000 500064 500128 500192 500256 500320 500384 500448 500512 500576 500640 500704 500768 500832 500896 500960 501024 501088 501152 501216 501280 501344 501408 501472 501536 501600 501664 501728 501792 501856 501920 501984 502048 502112 502176 502240 502304 502368 502432 502496 502560 502624...
output:
result:
Subtask #5:
score: 0
Wrong Answer
Test #56:
score: 0
Wrong Answer
time: 6ms
memory: 8608kb
input:
500000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
1000000000001
result:
wrong answer 1st lines differ - expected: '1000000000', found: '1000000000001'