QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#291425 | #6310. Dining Professors | marve197 | WA | 13ms | 3748kb | C++14 | 398b | 2023-12-26 16:01:39 | 2023-12-26 16:01:39 |
Judging History
answer
#include<bits/stdc++.h>
#define rep(i,x,n) for(int i=x;i<=n;i++)
using namespace std;
int n,m;
int p[200010];
main()
{
cin >> n >> m;
int a=m,b=n-m;
rep(i,1,n) cin >> p[i];
p[0]=p[n],p[n+1]=p[1];
int ans=0;
rep(i,1,n)
{
int c1=p[i-1]+p[i]+p[i+1],c2=3;
if(c1==c2||!b) a--,ans+=c1;
else b--,ans+=c2;
}
cout << ans;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3388kb
input:
5 2 1 0 1 0 1
output:
13
result:
ok 1 number(s): "13"
Test #2:
score: -100
Wrong Answer
time: 13ms
memory: 3748kb
input:
100000 33292 1 1 1 1 0 1 1 0 0 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 0 1 0 0 1 1 0 0 0 1 0 1 0 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 1 0 1 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 1 0 0 0 0 0 1 1 0 1 0 1 0 1 1 1 0 0...
output:
264571
result:
wrong answer 1st numbers differ - expected: '279236', found: '264571'