#include<bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ll N=1e5+5;
const ll K=350;
const ld pi=acos(-1);
const ll INF=(1LL<<60);
#define SQ(i) ((i)*(i))
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define setp setprecision
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()
vector<ll> countScans(vector<ll> A,vector<ll> X,vector<ll> V){
vector<ll> ans;
REP(i,SZ(X)){
A[X[i]]=V[i];
vector<pll> a;
ll res=0;
REP(j,SZ(A))a.pb(mp(A[j],j));
sort(a.begin(),a.end(),[](pll ta,pll tb){
return (ta.first!=tb.first?ta.first<tb.first:ta.second>tb.second);
});
REP(j,SZ(a))res=max(res,a[j].second-j);
ans.pb(res);
}
return ans;
}
/*
int main(){
vector<ll> A,X,V;
ll n,q,x;
cin>>n>>q;
REP(i,n)cin>>x,A.pb(x);
REP(i,q)cin>>x,X.pb(x),cin>>x,V.pb(x);
vector<ll> ans=countScans(A,X,V);
for(ll i:ans)cout<<i<<"\n";
}
//*/
Compilation message
bubblesort2.cpp:12:18: warning: overflow in conversion from 'long long int' to 'll' {aka 'int'} changes value from '1152921504606846976' to '0' [-Woverflow]
12 | const ll INF=(1LL<<60);
| ~~~~^~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
364 KB |
Output is correct |
2 |
Correct |
52 ms |
492 KB |
Output is correct |
3 |
Correct |
323 ms |
492 KB |
Output is correct |
4 |
Correct |
317 ms |
752 KB |
Output is correct |
5 |
Correct |
302 ms |
748 KB |
Output is correct |
6 |
Correct |
251 ms |
552 KB |
Output is correct |
7 |
Correct |
274 ms |
628 KB |
Output is correct |
8 |
Correct |
291 ms |
620 KB |
Output is correct |
9 |
Correct |
310 ms |
620 KB |
Output is correct |
10 |
Correct |
213 ms |
492 KB |
Output is correct |
11 |
Correct |
215 ms |
620 KB |
Output is correct |
12 |
Correct |
214 ms |
492 KB |
Output is correct |
13 |
Correct |
215 ms |
492 KB |
Output is correct |
14 |
Correct |
211 ms |
620 KB |
Output is correct |
15 |
Correct |
217 ms |
492 KB |
Output is correct |
16 |
Correct |
217 ms |
492 KB |
Output is correct |
17 |
Correct |
207 ms |
620 KB |
Output is correct |
18 |
Correct |
218 ms |
492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
364 KB |
Output is correct |
2 |
Correct |
52 ms |
492 KB |
Output is correct |
3 |
Correct |
323 ms |
492 KB |
Output is correct |
4 |
Correct |
317 ms |
752 KB |
Output is correct |
5 |
Correct |
302 ms |
748 KB |
Output is correct |
6 |
Correct |
251 ms |
552 KB |
Output is correct |
7 |
Correct |
274 ms |
628 KB |
Output is correct |
8 |
Correct |
291 ms |
620 KB |
Output is correct |
9 |
Correct |
310 ms |
620 KB |
Output is correct |
10 |
Correct |
213 ms |
492 KB |
Output is correct |
11 |
Correct |
215 ms |
620 KB |
Output is correct |
12 |
Correct |
214 ms |
492 KB |
Output is correct |
13 |
Correct |
215 ms |
492 KB |
Output is correct |
14 |
Correct |
211 ms |
620 KB |
Output is correct |
15 |
Correct |
217 ms |
492 KB |
Output is correct |
16 |
Correct |
217 ms |
492 KB |
Output is correct |
17 |
Correct |
207 ms |
620 KB |
Output is correct |
18 |
Correct |
218 ms |
492 KB |
Output is correct |
19 |
Correct |
4444 ms |
1116 KB |
Output is correct |
20 |
Correct |
5867 ms |
1036 KB |
Output is correct |
21 |
Correct |
5223 ms |
1152 KB |
Output is correct |
22 |
Correct |
5771 ms |
1152 KB |
Output is correct |
23 |
Correct |
3929 ms |
992 KB |
Output is correct |
24 |
Correct |
3919 ms |
996 KB |
Output is correct |
25 |
Correct |
3897 ms |
864 KB |
Output is correct |
26 |
Correct |
3953 ms |
992 KB |
Output is correct |
27 |
Correct |
3914 ms |
1004 KB |
Output is correct |
28 |
Correct |
3921 ms |
996 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7175 ms |
1232 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
364 KB |
Output is correct |
2 |
Correct |
52 ms |
492 KB |
Output is correct |
3 |
Correct |
323 ms |
492 KB |
Output is correct |
4 |
Correct |
317 ms |
752 KB |
Output is correct |
5 |
Correct |
302 ms |
748 KB |
Output is correct |
6 |
Correct |
251 ms |
552 KB |
Output is correct |
7 |
Correct |
274 ms |
628 KB |
Output is correct |
8 |
Correct |
291 ms |
620 KB |
Output is correct |
9 |
Correct |
310 ms |
620 KB |
Output is correct |
10 |
Correct |
213 ms |
492 KB |
Output is correct |
11 |
Correct |
215 ms |
620 KB |
Output is correct |
12 |
Correct |
214 ms |
492 KB |
Output is correct |
13 |
Correct |
215 ms |
492 KB |
Output is correct |
14 |
Correct |
211 ms |
620 KB |
Output is correct |
15 |
Correct |
217 ms |
492 KB |
Output is correct |
16 |
Correct |
217 ms |
492 KB |
Output is correct |
17 |
Correct |
207 ms |
620 KB |
Output is correct |
18 |
Correct |
218 ms |
492 KB |
Output is correct |
19 |
Correct |
4444 ms |
1116 KB |
Output is correct |
20 |
Correct |
5867 ms |
1036 KB |
Output is correct |
21 |
Correct |
5223 ms |
1152 KB |
Output is correct |
22 |
Correct |
5771 ms |
1152 KB |
Output is correct |
23 |
Correct |
3929 ms |
992 KB |
Output is correct |
24 |
Correct |
3919 ms |
996 KB |
Output is correct |
25 |
Correct |
3897 ms |
864 KB |
Output is correct |
26 |
Correct |
3953 ms |
992 KB |
Output is correct |
27 |
Correct |
3914 ms |
1004 KB |
Output is correct |
28 |
Correct |
3921 ms |
996 KB |
Output is correct |
29 |
Incorrect |
7175 ms |
1232 KB |
Output isn't correct |
30 |
Halted |
0 ms |
0 KB |
- |