#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;
int last[500005];
map<int, int> mp;
vector<int> ans;
vector<int> countScans(vector<int> a, vector<int> x, vector<int> y)
{
int n=a.size(), m=x.size(), sz=0;
for (int i=0; i<n; i++)
mp[a[i]]=0;
for (auto it=mp.begin(); it!=mp.end(); it++)
mp[it->first]=(++sz);
for (int i=0; i<n; i++)
last[a[i]=mp[a[i]]]=i;
for (int i=0; i<m; i++)
{
a[x[i]]=mp[y[i]];
int mx=0;
for (int j=0; j<sz; j++)
{
int cnt=0;
for (int k=0; k<last[j]; k++)
if (a[k]>a[last[j]])
cnt++;
mx=max(mx, cnt);
}
ans.push_back(mx);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
76 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
76 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3976 ms |
768 KB |
Output is correct |
2 |
Execution timed out |
9038 ms |
1360 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
76 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |