比赛 2024暑期C班集训2 评测结果 AAAAAAAAAA
题目名称 筹办模拟赛 最终得分 100
用户昵称 ┭┮﹏┭┮ 运行时间 0.000 s
代码语言 C++ 内存使用 0.00 MiB
提交时间 2024-07-02 08:22:38
显示代码纯文本
#include <bits/stdc++.h> 
using namespace std;
#define ll long long
const int N = 1e5+10;


ll read(){
   ll x = 0,f = 1;char c = getchar();
   for(;c < '0' || c > '9';c = getchar())if(c == '-')f = -1;
   for(;c >= '0' && c <= '9';c = getchar())x = (x<<1) + (x<<3) + c-'0';
   return x * f;
}

int n;
ll a[N],b[N];
int main(){
    freopen("proposal.in","r",stdin);
    freopen("proposal.out","w",stdout);
    n = read();
    for(int i = 1;i <= n;i++)a[i] = read();
    for(int i = 1;i <= n;i++)b[i] = read();
    if(a[1] > b[n]){
        printf("%d\n",n);
        return 0;
    }
    for(int i = 0;i <= n;i++){
        bool f = 1;
        for(int j = 1;j <= n;j++)
            if(j > i && a[j-i] > b[j])f = 0;
        if(f){
            printf("%d\n",i);
            return 0;
        }
    }
    
    
    return 0;
    
}