Submission #473161

# Submission time Handle Problem Language Result Execution time Memory
473161 2021-09-15T09:35:36 Z MamdouhN Doktor (COCI17_doktor) C++17
60 / 100
580 ms 36540 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"

map<pair<int,int>,int>idk;

main()
{
    int n;
    cin>>n;
    int ar[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar[i];
        int x = min(ar[i]-1,i);
        int y = max(ar[i]-1,i);
        int dist = min(x - 0 , n - y-1);
        //cout<<x-dist<<" "<<y+dist<<endl;
        idk[{ x-dist , y+dist }]++;
    }
    int x = 0;
    pair<int,int>ans;
    for(auto v:idk)
    {
        if(v.second>=x)
        {
            x = v.second;
            ans = v.first;
        }
    }
    cout<<ar[ans.first]<<" "<<ar[ans.second]<<endl;
}

Compilation message

doktor.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 236 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 460 KB Output is correct
2 Correct 2 ms 428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 716 KB Output is correct
2 Correct 101 ms 4516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 5112 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 580 ms 26564 KB Output is correct
2 Correct 175 ms 6212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 304 ms 15796 KB Output is correct
2 Correct 319 ms 36540 KB Output is correct