QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#291425#6310. Dining Professorsmarve197WA 13ms3748kbC++14398b2023-12-26 16:01:392023-12-26 16:01:39

Judging History

你现在查看的是最新测评结果

  • [2023-12-26 16:01:39]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:3748kb
  • [2023-12-26 16:01:39]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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'