답안 #916497

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
916497 2024-01-26T02:28:42 Z Darren0724 Cat Exercise (JOI23_ho_t4) C++17
7 / 100
21 ms 464 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define all(x) x.begin(),x.end()
#define abcorz ios_base::sync_with_stdio(false);cin.tie(0);
int32_t main(){
    abcorz;
    int n;cin>>n;
    vector<int> v(n),t(n+1);
    for(int i=0;i<n;i++){
        cin>>v[i];
        t[v[i]]=i;
    }
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=i;j<n;j++){
            int l=i,r=j;
            int last=-1;
            int cnt=0;
            for(int k=n;k>=1;k--){
                if(t[k]>=l&&t[k]<=r){
                    if(last==-1){
                        last=t[k];
                        continue;
                    }
                    cnt+=abs(last-t[k]);
                    if(last>t[k]){
                        r=last;
                    }
                    else{
                        l=last;
                    }
                    last=t[k];
                }
            }
            ans=max(ans,cnt);
        }
    }
    cout<<ans<<endl;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 15 ms 344 KB Output is correct
12 Correct 20 ms 348 KB Output is correct
13 Correct 21 ms 464 KB Output is correct
14 Incorrect 16 ms 348 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 15 ms 344 KB Output is correct
12 Correct 20 ms 348 KB Output is correct
13 Correct 21 ms 464 KB Output is correct
14 Incorrect 16 ms 348 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 15 ms 344 KB Output is correct
12 Correct 20 ms 348 KB Output is correct
13 Correct 21 ms 464 KB Output is correct
14 Incorrect 16 ms 348 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 15 ms 344 KB Output is correct
12 Correct 20 ms 348 KB Output is correct
13 Correct 21 ms 464 KB Output is correct
14 Incorrect 16 ms 348 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 5 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 15 ms 344 KB Output is correct
12 Correct 20 ms 348 KB Output is correct
13 Correct 21 ms 464 KB Output is correct
14 Incorrect 16 ms 348 KB Output isn't correct
15 Halted 0 ms 0 KB -