Submission #1116091

# Submission time Handle Problem Language Result Execution time Memory
1116091 2024-11-21T08:59:31 Z ezzzay Ekoeko (COCI21_ekoeko) C++14
0 / 110
22 ms 29776 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
const int N=3e5+5;
vector<int>a[N],b[N];
int p[N];
int bit[N];
int find(int idx){
    int s=0;
    while(idx>0){
        s+=bit[idx];
        idx-= idx & -idx;
    }
    return s;
}
void update(int idx, int val){
    while(idx<N){
        bit[idx]+=val;
        idx+= idx & -idx;
    }
}
signed main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<2*n;i++){
        if(i<n)a[s[i]].pb(i);
        else b[s[i]].pb(i);
    }
    for(int i=n-1;i>=0;i--){
        p[ b[s[i]].back() - n +1 ] =i+1; 
        b[s[i]].pop_back();
    }
    int ans=0;
    return 0;
    for(int i=1;i<=n;i++){
        continue;
        update(p[i],1);
        ans+=i-find(p[i]);
    }
    cout<<ans;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:31:22: warning: array subscript has type 'char' [-Wchar-subscripts]
   31 |         if(i<n)a[s[i]].pb(i);
      |                      ^
Main.cpp:32:20: warning: array subscript has type 'char' [-Wchar-subscripts]
   32 |         else b[s[i]].pb(i);
      |                    ^
Main.cpp:35:18: warning: array subscript has type 'char' [-Wchar-subscripts]
   35 |         p[ b[s[i]].back() - n +1 ] =i+1;
      |                  ^
Main.cpp:36:15: warning: array subscript has type 'char' [-Wchar-subscripts]
   36 |         b[s[i]].pop_back();
      |               ^
# Verdict Execution time Memory Grader output
1 Runtime error 22 ms 29776 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 22 ms 29776 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 22 ms 29776 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 17148 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 22 ms 29776 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -