QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#412496#6748. Spin the WheelincloudCompile Error//C++14666b2024-05-16 15:17:142024-05-16 15:17:15

Judging History

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

  • [2024-05-16 15:17:15]
  • 评测
  • [2024-05-16 15:17:14]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
    int n;
    cin>>n;
    vector<int> a(n+1);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    a[n]=a[0];
    int ans=a[1]-a[0];
    if(a[1]<a[0])ans+=n;
    bool ok=1;
    for(int i=1;i<=n;i++){
        if(a[i]!=(a[i-1]+ans)%n){
            ok=false;
            break;
        }
    }
    if(ok){
        if(a[0]==0){
            cout<<ans<<'\n';
        }
        else {

            cout<<ans+1<<'\n';
        }
    }
    else cout<<-1<<'\n';

    return 0;
}

Details

answer.code:6:1: error: extended character   is not valid in an identifier
    6 |     int n;
      | ^
answer.code:6:3: error: extended character   is not valid in an identifier
    6 |     int n;
      |   ^
answer.code:7:1: error: extended character   is not valid in an identifier
    7 |     cin>>n;
      | ^
answer.code:7:3: error: extended character   is not valid in an identifier
    7 |     cin>>n;
      |   ^
answer.code:8:1: error: extended character   is not valid in an identifier
    8 |     vector<int> a(n+1);
      | ^
answer.code:8:3: error: extended character   is not valid in an identifier
    8 |     vector<int> a(n+1);
      |   ^
answer.code:9:1: error: extended character   is not valid in an identifier
    9 |     for(int i=0;i<n;i++){
      | ^
answer.code:9:3: error: extended character   is not valid in an identifier
    9 |     for(int i=0;i<n;i++){
      |   ^
answer.code:10:1: error: extended character   is not valid in an identifier
   10 |         cin>>a[i];
      | ^
answer.code:10:3: error: extended character   is not valid in an identifier
   10 |         cin>>a[i];
      |   ^
answer.code:10:5: error: extended character   is not valid in an identifier
   10 |         cin>>a[i];
      |     ^
answer.code:10:7: error: extended character   is not valid in an identifier
   10 |         cin>>a[i];
      |       ^
answer.code:11:1: error: extended character   is not valid in an identifier
   11 |     }
      | ^
answer.code:11:3: error: extended character   is not valid in an identifier
   11 |     }
      |   ^
answer.code:12:1: error: extended character   is not valid in an identifier
   12 |     a[n]=a[0];
      | ^
answer.code:12:3: error: extended character   is not valid in an identifier
   12 |     a[n]=a[0];
      |   ^
answer.code:13:1: error: extended character   is not valid in an identifier
   13 |     int ans=a[1]-a[0];
      | ^
answer.code:13:3: error: extended character   is not valid in an identifier
   13 |     int ans=a[1]-a[0];
      |   ^
answer.code:14:1: error: extended character   is not valid in an identifier
   14 |     if(a[1]<a[0])ans+=n;
      | ^
answer.code:14:3: error: extended character   is not valid in an identifier
   14 |     if(a[1]<a[0])ans+=n;
      |   ^
answer.code:15:1: error: extended character   is not valid in an identifier
   15 |     bool ok=1;
      | ^
answer.code:15:3: error: extended character   is not valid in an identifier
   15 |     bool ok=1;
      |   ^
answer.code:16:1: error: extended character   is not valid in an identifier
   16 |     for(int i=1;i<=n;i++){
      | ^
answer.code:16:3: error: extended character   is not valid in an identifier
   16 |     for(int i=1;i<=n;i++){
      |   ^
answer.code:17:1: error: extended character   is not valid in an identifier
   17 |         if(a[i]!=(a[i-1]+ans)%n){
      | ^
answer.code:17:3: error: extended character   is not valid in an identifier
   17 |         if(a[i]!=(a[i-1]+ans)%n){
      |   ^
answer.code:17:5: error: extended character   is not valid in an identifier
   17 |         if(a[i]!=(a[i-1]+ans)%n){
      |     ^
answer.code:17:7: error: extended character   is not valid in an identifier
   17 |         if(a[i]!=(a[i-1]+ans)%n){
      |       ^
answer.code:18:1: error: extended character   is not valid in an identifier
   18 |             ok=false;
      | ^
answer.code:18:3: error: extended character   is not valid in an identifier
   18 |             ok=false;
      |   ^
answer.code:18:5: error: extended character   is not valid in an identifier
   18 |             ok=false;
      |     ^
answer.code:18:7: error: extended character   is not valid in an identifier
   18 |             ok=false;
      |       ^
answer.code:18:9: error: extended character   is not valid in an identifier
   18 |             ok=false;
      |         ^
answer.code:18:11: error: extended character   is not valid in an identifier
   18 |             ok=false;
      |           ^
answer.code:19:1: error: extended character   is not valid in an identifier
   19 |             break;
      | ^
answer.code:19:3: error: extended character   is not valid in an identifier
   19 |             break;
      |   ^
answer.code:19:5: error: extended character   is not valid in an identifier
   19 |             break;
      |     ^
answer.code:19:7: error: extended character   is not valid in an identifier
   19 |             break;
      |       ^
answer.code:19:9: error: extended character   is not valid in an identifier
   19 |             break;
      |         ^
answer.code:19:11: error: extended character   is not valid in an identifier
   19 |             break;
      |           ^
answer.code:20:1: error: extended character   is not valid in an identifier
   20 |         }
      | ^
answer.code:20:3: error: extended character   is not valid in an identifier
   20 |         }
      |   ^
answer.code:20:5: error: extended character   is not valid in an identifier
   20 |         }
      |     ...