Submission #473153

#TimeUsernameProblemLanguageResultExecution timeMemory
473153MamdouhNDoktor (COCI17_doktor)C++17
70 / 100
559 ms37444 KiB
#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); 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 (stderr)

doktor.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...