QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#303780 | #6310. Dining Professors | silver_muse | WA | 7ms | 5136kb | C++14 | 604b | 2024-01-12 23:40:38 | 2024-01-12 23:40:39 |
Judging History
answer
#include<bits/stdc++.h>
#define ph push_back
#define pp pop_back
#define ff first
#define ss second
#define endl '\n'
#define int long long
using namespace std;
const int N=1e5+5;
int n,gg,a[N],b[N];
signed main()
{
// freopen("temp.in","r",stdin);
// freopen("temp.out","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin>>n>>gg;
for(int i=0;i<n;i++) cin>>a[i];
for(int i=0;i<n;i++)
{
if(!a[(i-1+n)%n]) b[i]++;
if(!a[(i+1)%n]) b[i]++;
if(!a[i]) b[i]++;
}
sort(b,b+n);
int s=0;
for(int i=1;i<=gg;i++) s+=b[i];
cout<<3*n-s;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3624kb
input:
5 2 1 0 1 0 1
output:
13
result:
ok 1 number(s): "13"
Test #2:
score: -100
Wrong Answer
time: 7ms
memory: 5136kb
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:
279235
result:
wrong answer 1st numbers differ - expected: '279236', found: '279235'