| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1365938 | kmath628 | Exam (eJOI20_exam) | C++20 | 669 ms | 428 KiB |
#include <bits/stdc++.h>
using namespace std;
int a[209],b[209],a0[209];
int main(){
int n,i,j,l,r,d,ans=0;
scanf("%d",&n);
for(i=1;i<=n;i++) scanf("%d",&a0[i]);
for(i=1;i<=n;i++) scanf("%d",&b[i]);
for(int t=1;t<=100000;t++){
for(i=1;i<=n;i++) a[i]=a0[i];
for(j=1;j<=20;j++){
l=rand()%n+1;
r=rand()%n+1;
//printf("l=%d r=%d\n",l,r);
if(l<=r){
int mx=0;
for(int k=l;k<=r;k++){
mx=max(mx,a[k]);
}
for(int k=l;k<=r;k++) a[k]=mx;
int cnt=0;
for(int k=1;k<=n;k++){
cnt+=(int)(a[k]==b[k]);
}
ans=max(ans,cnt);
}
}
}
printf("%d\n",ans);
return 0;
}
Compilation message (stderr)
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
