QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#411604#6748. Spin the WheelzhangmeixingCompile Error//C++23887b2024-05-15 16:35:182024-05-15 16:35:19

Judging History

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

  • [2024-05-15 16:35:19]
  • 评测
  • [2024-05-15 16:35:18]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define int long long
#define inf 1e18
#define rep(i, l, n) for (int  i = l; i <= n; i++)
#define per(i, l, n) for (int  i = n; i >= l; i--)
//cout<<fixed<<setprecision(15)
const int mol=998244353;
const int N = 3e5+10,M=5010;
int qmi(int a,int k){int res=1;while(k){if(k&1)res=res*a%mol;a=a*a%mol;k>>=1;}return res;}
int inv(int x){return qmi(x%mol,mol-2);}
int n,m,q,k;
int a[N];
void solve()
{
  cin>>n;
  rep(i,1,n)cin>>a[i];
  m=(a[1]-a[0]+n)%n;
  rep(i,1,n-1)
  {
    if((a[i+1]-a[i]+n)%n!=m)
    {
      cout<<-1<<endl;
      return ;
    }
  }
  if(!a[0]){cout<<m<<endl;
  return ;
  }
  if(!m)m+=n;
  return m+1;
}
signed main()
{
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int T = 1;
   //cin>>T;
  for (int i = 1; i <= T; i++)solve();
  return 0;
}

详细

answer.code: In function ‘void solve()’:
answer.code:32:11: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
   32 |   return m+1;
      |          ~^~