Submission #80854

#TimeUsernameProblemLanguageResultExecution timeMemory
80854luckyboyDoktor (COCI17_doktor)C++14
40 / 100
1084 ms12332 KiB
/** 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 (stderr)

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 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...