QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#809212#9871. Just another Sorting Problem3343156983Compile Error//C++14656b2024-12-11 13:17:382024-12-11 13:17:39

Judging History

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

  • [2024-12-11 13:17:39]
  • 评测
  • [2024-12-11 13:17:38]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        string x;
        cin>>n>>x;
        int sum=0;
        vector<int> a(n+1)
        for(int i=1;i<=n;i++){
            int y;
            cin>>y;
            a[i]=y;
            if(y!=i) sum++;
        }
        if(n==2){
            cout<<"Alice"<<endl;
        }
        else if(n==3&&sum==3&&a[1]==2&&a[2]==3&&a[3]==1){
            cout<<"Alice"<<endl;
        }
        else if(sum<=2&&x=="Alice"){
            cout<<"Alice"<<endl;
        }else{
            cout<<"Bob"<<endl;
        }
        
    }
}

详细

answer.code: In function ‘int main()’:
answer.code:12:9: error: expected ‘,’ or ‘;’ before ‘for’
   12 |         for(int i=1;i<=n;i++){
      |         ^~~
answer.code:12:21: error: ‘i’ was not declared in this scope
   12 |         for(int i=1;i<=n;i++){
      |                     ^