Submission #473206

# Submission time Handle Problem Language Result Execution time Memory
473206 2021-09-15T10:16:28 Z BidoTeima Doktor (COCI17_doktor) C++17
30 / 100
1000 ms 2124 KB
/// isA AC
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void ACPLS(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define tc int tttttt;cin>>tttttt;while(tttttt--)
#define sumrange(l,r,arr) (l==0?arr[r]:arr[r]-arr[l-1])
#define all(v) v.begin(),v.end()
int main(){
    ACPLS(); 
    int n;
    cin>>n;
    int a[n+5];
    for(int i = 1; i <= n; i++){
        cin>>a[i];
    }
    int ans=0;
    pair<int,int> best={a[1],a[1]};
    for(int i = 1; i <= n; i++){
        for(int j = i+1; j <= n; j++){
            int res=0;
            for(int k = i; k <= j; k++){
                if(a[k]==k)--res;
                if(a[k]==j-k+i)++res;
            }
            if(res>ans){
                ans=res;
                best={a[i],a[j]};
            }
        }
    }
    cout<<best.first<<' '<<best.second;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 304 KB Output is correct
2 Correct 15 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 2124 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1099 ms 1356 KB Time limit exceeded
2 Halted 0 ms 0 KB -