Đề thi thử đợt 1 TS10 chuyên Tin trường THPT Chuyên KHTN 2026


Bình luận

Hãy đọc nội quy trước khi bình luận.



  • 0
    hanhcr7  đã bình luận lúc 20, Tháng 5, 2026, 4:03

    include <bits/stdc++.h>

    using namespace std;

    define ll long long

    define st string

    define ha7 iosbase::syncwith_stdio(false);cin.tie(0);cout.tie(0);

    ll n,m; vector<ll>pre; bool check(ll x) { ll min1=1e18; for(ll i=x; i<=n; i++) { min1=min(min1,pre[i-x]); if(pre[i]-min1>=0) { return true; } } return false; } int main() { ha7 cin>>n>>m; vector<ll>a(n+1),b(n+1); pre.resize(n+1,0); for(ll i=1; i<=n; i++) { cin>>a[i]; } for(ll i=1; i<=n; i++) { cin>>b[i]; } for(ll i=1; i<=n; i++) { pre[i]=pre[i-1]+(a[i]+b[i]-m); } ll l=1,r=n,mid,ans=0; while(l<=r) { mid=(l+r)/2; if(check(mid)) { ans=mid; l=mid+1; } else { r=mid-1; } } cout<<ans; }


  • 0
    missmphuog  đã bình luận lúc 7, Tháng 3, 2026, 9:05
    #include <bits/stdc++.h>
    using namespace std;
    
    #define ll long long
    #define ull unsigned long long
    #define ld long double
    
    #define pb push_back
    #define pf push_front
    #define fi first
    #define se second
    
    #define all(x) (x).begin(), (x).end()
    #define rall(x) (x).rbegin(), (x).rend()
    
    #define faster() ios::sync_with_stdio(false); cin.tie(nullptr);
    #define endl '\n'
    
    #define yes cout << "YES\n"
    #define no  cout << "NO\n"
    
    #define pii pair<int,int>
    #define pll pair<ll,ll>
    #define vi vector<int>
    #define vl vector<ll>
    const int maxn = 1e6;
    int a[maxn+10],n,d=0;
    int main() {
        faster();
        cin>>n;
        map<int,int> mp;
        for(int i=1;i<=n;i++) {
            cin>>a[i];
            mp[a[i]]++;
        }
        vi v;
        for(auto it:mp) {
            if(it.second>=3) {
                v.push_back(it.first);
            }
        }
        if(!v.empty()) cout<&lt;v[0];
        else cout<<-1;
        return 0;
    }