QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#220731 | #6310. Dining Professors | smallzhuzi# | WA | 3ms | 7672kb | C++14 | 807b | 2023-10-20 19:05:42 | 2023-10-20 19:05:43 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define endl "\n"
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef pair<int,int> pii;
const int N=1000010,inf=LLONG_MAX,mod=998244353;
int t,n,m,a[N],b[N],vis[N];
string yes="Yes",no="No";
void solve(){
cin>>n>>m;
int ans=n*3;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<=n;i++){
b[i]=a[i-1]+a[i]+a[i+1];
}
b[1]+=a[n];
b[n]+=a[1];
sort(b+1,b+n+1);
for(int i=n;i>=1;i--){
if(m==0)break;
m--;
if(b[i]==2)ans--;
else if(b[i]==1)ans-=2;
else ans-=3;
}
cout<<ans<<endl;
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
t=1;
// cin>>t;
while(t--){
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 7672kb
input:
5 2 1 0 1 0 1
output:
13
result:
ok 1 number(s): "13"
Test #2:
score: -100
Wrong Answer
time: 3ms
memory: 7540kb
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:
241652
result:
wrong answer 1st numbers differ - expected: '279236', found: '241652'