Submission #80854

# Submission time Handle Problem Language Result Execution time Memory
80854 2018-10-22T14:27:31 Z luckyboy Doktor (COCI17_doktor) C++14
40 / 100
1000 ms 12332 KB
/** Lucky Boy **/
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define maxc 1000000007
#define maxn 500006
#define maxm 500005
#define pii pair <int,int>
#define Task ""
using namespace std;
int n,a[maxn],cnt[maxn << 1],ans,l,r;
int main()
{
    //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen(".inp", "r",stdin);
    scanf("%d",&n);
    FOR(i,1,n) scanf("%d",&a[i]),a[i] += i;
    FOR(i,1,n)
    {
        FOR(j,1,2*n) cnt[j] = 0;
        FOR(j,i,n)
        {
            ++cnt[a[j]];
            if (cnt[i+j] > ans)
            {
                ans = cnt[i+j];
                l = i,r = j;
            }
        }
    }
    a[l] -= l;
    if (l != r) a[r] -= r;
    printf("%d %d",a[l],a[r]);
}

Compilation message

doktor.cpp: In function 'int main()':
doktor.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
doktor.cpp:21:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     FOR(i,1,n) scanf("%d",&a[i]),a[i] += i;
                ~~~~~~~~~~~~~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 528 KB Output is correct
2 Correct 7 ms 552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 560 KB Output is correct
2 Correct 12 ms 712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 65 ms 712 KB Output is correct
2 Incorrect 2 ms 728 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 171 ms 988 KB Output is correct
2 Execution timed out 1055 ms 6384 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 6384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 12332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 12332 KB Time limit exceeded
2 Halted 0 ms 0 KB -