QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#297453 | #6310. Dining Professors | yokeff# | WA | 4ms | 3808kb | C++17 | 616b | 2024-01-04 14:36:08 | 2024-01-04 14:36:09 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
int v[4];
signed main (){
std::ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,a;
cin>>n>>a;
vector<int> c(n+3);
int ans = 0;
for(int i=1;i<=n;i++)
{
cin>>c[i];
if(c[i]==1)
ans +=3;
}
c[n+1] = c[1];
c[n+2] = c[2];
for(int i=2;i<=n+1;i++)
{
int num = 0;
if(c[i-1]==0)
num++;
if(c[i]==0)
num++;
if(c[i+1]==0)
num++;
v[num]++;
}
a = n-a;
int l = 3;
while(a--)
{ v[l]--;
while(v[l]<=0)
l--;
ans +=l;
}
cout<<ans<<endl;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3564kb
input:
5 2 1 0 1 0 1
output:
13
result:
ok 1 number(s): "13"
Test #2:
score: -100
Wrong Answer
time: 4ms
memory: 3808kb
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:
279234
result:
wrong answer 1st numbers differ - expected: '279236', found: '279234'