Language: C++

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int N,K,C;
int A[200001];
int B[200001];
vector<int> ans;
 
 
 
int main(){
    int k = 0;
    int cntt=0;
    cin >> N >> K >> C;
    int cnt=10000001;
    for(int i=0;i<N;i++){
        char s;
        cin >> s;
        if (s == 'o' && cnt < C){
            A[i] = 1;
            cnt++;
        } else if (s == 'x'){
            A[i] = 0;
            cnt++;
        } else {
            A[i] = 2;
            B[k] = cnt;
            cnt = 0;
            k++;
            cntt = i;
        }
    }
    B[k] = N-cntt-1;
    
    if (k>K){
        return 0;
    }
    int i=N-1;
    int cnttt = C;
    while(k>0){
        for (int j=0;j<B[k]+1;j++){
            if(A[i-j] == 1){
                if(C-j <= cnttt){
                    cnttt = B[k]-j;
                    break;
                }
            }else if(A[i-j] == 2){
                cnttt = 0;
                ans.push_back(i-j+1);
            }
        }
        i -= (B[k]+1);
        k--;
    }
    for(ll j=ans.size()-1;j>=0;j--){
        cout << ans[j] << endl;
    }
    
}
 
 
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int N,K,C;
int A[100001];
int B[100001];
vector<int> ans;



int main(){
    int k = 0;
    int cntt=0;
    cin >> N >> K >> C;
    int cnt=10000001;
    for(int i=0;i<N;i++){
        char s;
        cin >> s;
        if (s == 'o' && cnt < C){
            A[i] = 1;
            cnt++;
        } else if (s == 'x'){
            A[i] = 0;
            cnt++;
        } else {
            A[i] = 2;
            B[k] = cnt;
            cnt = 0;
            k++;
            cntt = i;
        }
    }
    B[k] = N-cntt-1;
    
    if (k>K){
        return 0;
    }
    int i=N-1;
    int cnttt = C;
    while(k>0){
        for (int j=0;j<B[k]+1;j++){
            if(A[i-j] == 1){
                if(C-j <= cnttt){
                    cnttt = B[k]-j;
                    break;
                }
            }else if(A[i-j] == 2){
                cnttt = 0;
                ans.push_back(i-j+1);
            }
        }
        i -= (B[k]+1);
        k--;
    }
    for(ll j=ans.size()-1;j>=0;j--){
        cout << ans[j] << endl;
    }
    
}


提出

Compiler output:
a.cc:79:5: error: redefinition of 'int N'
   79 | int N,K,C;
      |     ^
a.cc:11:5: note: 'int N' previously declared here
   11 | int N,K,C;
      |     ^
a.cc:79:7: error: redefinition of 'int K'
   79 | int N,K,C;
      |       ^
a.cc:11:7: note: 'int K' previously declared here
   11 | int N,K,C;
      |       ^
a.cc:79:9: error: redefinition of 'int C'
   79 | int N,K,C;
      |         ^
a.cc:11:9: note: 'int C' previously declared here
   11 | int N,K,C;
      |         ^
a.cc:80:5: error: conflicting declaration 'int A [100001]'
   80 | int A[100001];
      |     ^
a.cc:12:5: note: previous declaration as 'int A [200001]'
   12 | int A[200001];
      |     ^
a.cc:81:5: error: conflicting declaration 'int B [100001]'
   81 | int B[100001];
      |     ^
a.cc:13:5: note: previous declaration as 'int B [200001]'
   13 | int B[200001];
      |     ^
a.cc:82:13: error: redefinition of 'std::vector<int> ans'
   82 | vector<int> ans;
      |             ^~~
a.cc:14:13: note: 'std::vector<int> ans' previously declared here
   14 | vector<int> ans;
      |             ^~~
a.cc:86:5: error: redefinition of 'int main()'
   86 | int main(){
      |     ^~~~
a.cc:18:5: note: 'int main()' previously defined here
   18 | int main(){
      |     ^~~~
a.cc:137:1: error: '\U000063d0\U000051fa' does not name a type
  137 | 提出
      | ^~~~