QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#715782 | #7964. 转化 | sdmrlh# | WA | 68ms | 19456kb | C++14 | 1.4kb | 2024-11-06 13:24:24 | 2024-11-06 13:24:26 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define sf(x) scanf("%lld",&x)
#define sff(x,y) scanf("%lld%lld",&x,&y)
#define endl '\n'
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pf(x) printf("%lld",x)
#define pii pair<int,int>
#define f first
#define s second
#define int long long
//
const int N = 1e6+10;
int ss;
int res=0;
int a[N],b[N],c[N];
//
//
void solve()
{
int m;
cin>>m;
for(int i=1;i<=m;i++) cin>>a[i];
for(int i=1;i<=m;i++) cin>>b[i];
for(int i=1;i<=m;i++) cin>>c[i];
vector<int> ab,bc;
int sum=0,res1=0,res2=0;
for(int i=1;i<=m;i++)
{
sum+=c[i]+a[i];
if(a[i]&&b[i]) ab.push_back(i);
else if(b[i]&&c[i]) bc.push_back(i);
}
for(auto i:ab)
res1+=min(a[i]+c[i],b[i]);
if(!res1){
int sum1=0;
for(int i=1;i<m;i++){
cout<<a[i]+c[i]<<" ";
if(a[i]) sum1+=a[i]+c[i];
}
if(a[m]) sum1+=a[m]+c[m];
cout<<a[m]+c[m]<<endl<<sum1<<endl;
return ;
}
res1--;
for(auto i:bc)
res2+=min(b[i],c[i]+1)-1;
res2++;
for(int i=1;i<=m;i++)
{
if(!b[i]) cout<<res1+res2+a[i]+c[i];
else
{
if(a[i]) cout<<res1-min(a[i]+c[i],b[i])+res2+a[i]+c[i];
else if(!c[i]) cout<<res1+res2;
else cout<<res1+res2-min(b[i],c[i]+1)+1+c[i];
}
if(i==m) cout<<endl;
else cout<<" ";
}
cout<<sum<<endl;
}
signed main()
{
IOS;
int _=1;
while(_--)
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 68ms
memory: 19456kb
input:
351493 0 37836791 46095966 46912389 21595941 0 3 86568894 3 0 0 0 0 39910208 0 2 4 86885825 1 67660833 0 24488082 52447896 0 67190942 70457491 11166998 90470470 11095822 0 0 5 47222930 2 49736354 0 0 0 77339472 0 5 3 0 25347727 0 3 2 0 48844622 0 65142757 1 73733079 80634668 46683173 0 31644647 9760...
output:
60073965049724 60073472376204 60073472376204 60073481727701 60073472376204 60073788737330 60073528128564 60073472376204 60073844358663 60073784179153 60073472376204 60073472376204 60073948665985 60073472376204 60073472376204 60073667185445 60073550333929 60073472376204 60073631548329 60073472376204 ...
result:
ok 2 lines
Test #2:
score: -100
Wrong Answer
time: 62ms
memory: 17616kb
input:
351493 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 3 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 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:
389246793 773056414 285033292 35143062 150613 960166465 230310734 742299190 422307527 716629610 559282116 167517603 440667606 980062124 288964464 150613 37777273 995600801 890644898 919111990 697350089 651910449 818599875 248723392 345836780 145972754 169220149 798545767 375398590 724669763 34806631...
result:
wrong answer 2nd lines differ - expected: '115186454532787', found: '160138825249410'