# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
900597 |
2024-01-08T15:35:37 Z |
HamzaT |
Ekoeko (COCI21_ekoeko) |
C++14 |
|
1 ms |
348 KB |
//struct Edge {int u, v, weight;bool operator<(Edge const& other) {return weight < other.weight;}};
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
#define sp ' '
#define pb push_back
#define ar for(int i=1;i<=n;i++)
using namespace std;
ll t=1;
const ll N=3e5+100;
ll n,m,q,k;
bool vis[N];
ll mx=0;
ll ans=0;
ll last;
char a[N];
pair<int,int>p[N];
void solve()
{
map<char,int>mp;
cin>>n;
for(int i=1;i<=2*n;i++)
{
cin>>a[i];
}
for(int i=n+1;i<=2*n;i++){mp[a[i]]=i-n;}
ll cur=0;
for(int i=1;i<=n;i++)
{
ans+=mp[a[i]]-i-cur;cur++;
}
cout<<abs(ans)<<endl;return;
}
int main()
{
//freopen("shell.in", "r", stdin);
// freopen("shell.out", "w", stdout);
ios::sync_with_stdio(NULL);
cin.tie(NULL);cout.tie(NULL);
// cin>>t;
while(t--){solve();}
return 0;
}
//09:00 :: 9:45
//10:30 ::
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |