QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#103195#6310. Dining ProfessorsNerovix#WA 0ms3440kbC++141.3kb2023-05-04 18:38:372023-05-04 18:38:37

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-04 18:38:37]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3440kb
  • [2023-05-04 18:38:37]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
// #define int ll
#define pii pair<int,int>
#define se second
#define fi first
#define mpr make_pair
#define ull unsigned long long
// const int mod=1e9+7;
const int mod=998244353;
int add(int x,int y){
	x+=y;return x>=mod?x-mod:x;
}
void adto(int&x,int y){
	x+=y;
	x>=mod?x-=mod:x;
}
int mul(int x,int y){
	return 1ll*x*y%mod;
}
int qpow(int a,int b){
	int ans=1;
	while(b){
		if(b&1)ans=mul(ans,a);
		a=mul(a,a);
		b>>=1;
	}
	return ans;
}

const int maxn=1e6+10;
int n,a;
int b[maxn];
void solve(){
    cin>>n>>a;
    for(int i=1;i<=n;i++){
        cin>>b[i];
    }
    vector<int>v;
    for(int i=1;i<=n;i++){
        int tmp=0;
        tmp+=b[i];
        tmp+=b[i%n+1];
        tmp+=b[(i+n-2)%n+1];
        cout<<tmp<<" \n"[i==n];
        v.pb(tmp);
    }
    sort(v.begin(),v.end(),greater<int>());
    int ans=0;
    for(int i=0;i<a;i++){
        ans+=v[i];
    }
    for(int i=a;i<v.size();i++){
        ans+=3;
    }
    cout<<ans<<"\n";
}

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	int t=1;
	// cin>>t;
	while(t--){
		solve();
	}
	// cerr<<1.*clock()/CLOCKS_PER_SEC<<"s...\n";
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3440kb

input:

5 2
1 0 1 0 1

output:

2 2 1 2 2
13

result:

wrong answer 1st numbers differ - expected: '13', found: '2'