Submission #473156

# Submission time Handle Problem Language Result Execution time Memory
473156 2021-09-15T09:31:32 Z Ahmed_Solyman Doktor (COCI17_doktor) C++14
20 / 100
1000 ms 6572 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){
    ll n;cin>>n;
    vector<ll>arr(n);
    for(auto &i:arr)cin>>i;
    ll x=1,y=1;
    ll mx=0;
    for(ll i=0;i<n;i++){
        for(ll j=i+1;j<n;j++){
            ll cnt=0,sz=j-i+1;
            for(ll k=i;k<=j;k++){
                ll idx=i+(sz-k);
                cnt+=(arr[k]==idx);
            }
            if(cnt>mx){
                x=arr[i];y=arr[j];
                mx=cnt;
            }
        }
    }
    cout<<x<<" "<<y<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 1484 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 6572 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 4292 KB Time limit exceeded
2 Halted 0 ms 0 KB -