Submission #935747

# Submission time Handle Problem Language Result Execution time Memory
935747 2024-02-29T13:27:08 Z fdnfksd Arcade (NOI20_arcade) C++14
0 / 100
1 ms 4444 KB
#include<bits/stdc++.h>
#define pb push_back
#define pli pair<int,int>
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
using ll=long long;
const ll maxn=2e5;
const ll inf=1e18;
const ll mod=1e9+7;
ll n,m,t[maxn],a[maxn],e[maxn];
pli b[maxn];
void solve()
{
    cin >> m >> n;
    for(int i=1;i<=n;i++) cin >> t[i];
    for(int i=1;i<=n;i++) cin >> a[i];
    for(int i=1;i<=n;i++)
    {
        b[i].fi=a[i]+t[i];
        b[i].se=a[i]-t[i];
    }
    sort(b+1,b+n+1);
    ll sz=0;
    for(int i=1;i<=n;i++)
    {
        ll low=1,high=sz;
        while(low<=high)
        {
            ll mid=low+high>>1;
            if(e[mid]<=b[i].se) high=mid-1;
            else low=mid+1;
        }
        if(low>sz) sz++;
        e[low]=b[i].se;
    }
    cout << sz;
}
int main()
{
    fastio
    //freopen(TASKNAME".INP","r",stdin);
    //freopen(TASKNAME".OUT","w",stdout);
    solve();
}

Compilation message

Arcade.cpp: In function 'void solve()':
Arcade.cpp:31:23: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   31 |             ll mid=low+high>>1;
      |                    ~~~^~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -