Submission #979928

# Submission time Handle Problem Language Result Execution time Memory
979928 2024-05-11T16:16:49 Z vjudge1 Closing Time (IOI23_closing) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define endl '\n'
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define fo(i,n) for(auto i =0 ; i < n;i++)
#define fore(i,l,r) for(auto i = l; i < r;i++)
#define forex(i,r,l) for(auto i = r; i >= l; i--)
#define ffo(i,n) forex(i,n-1,0)
#define all(x) x.begin(),x.end()
#define lsb(x) x&(-x)
#define sz(x) (int)x.size()
#define gcd(a,b) __gcd(a,b)
#define vii vector<ii>
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<ll>;using ii = pair<ll,ll>;using mii = map<ll,ll>;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
int max_score(int n, int x, int y, ll k, int u[], int v[], int w[]){
    ll suf[n+1]{}, pre[n+1]{};
    fore(i,1,n)pre[i] = (i ? w[i-1] : 0) + (i ? pre[i-1] : 0);
    ffo(i,n-1)suf[i] = w[i] + suf[i+1];
    ll ans = 0, tot= 0;
    for(ll i=x;i>=0;i--){
        ans+=suf[i] - suf[x];
        for(ll j=x;j <=n-1;j++){
            ans+=pre[j]-pre[x];
            for(ll l=y;l>=0;l--){
                if(l>j)ans+=suf[l]- suf[y];
                else{
                    if(l>x){ans+=max(suf[l]-suf[y], pre[l] - pre[x]);ans-=min(suf[l]-suf[y], pre[l] - pre[x]);}
                    else ans+=suf[l]-suf[y];
                }
                for(ll lk=y;lk<=n-1;lk++){
                    if(j<lk)ans+=pre[lk]-pre[y];
                    // cout << i << " " << j << " " << l << " " << lk << " " << ans << endl;
                    if(ans<=k)tot = max(tot,j-i+1 + lk-l+1);
                }
                for(ll lk=y;lk<=n-1;lk++)
                    if(j<lk)ans-=pre[lk] - pre[y];
            }
            for(ll l =y;l>=0;l--){
                if(l>j)ans-=suf[l]- suf[y];
                else{
                    if(l>x){ans-=max(suf[l]-suf[y], pre[l] - pre[x]);ans+=min(suf[l]-suf[y], pre[l] - pre[x]);}
                    else ans-=suf[l]-suf[y];
                }
            }
            // cout<<ans<<endl;
        }
        for(ll j =x;j<=n-1;j++)
            ans-=pre[j]-pre[x];
    }
    return tot;
}

Compilation message

closing.cpp:20: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   20 | #pragma GCC optimization ("O3")
      | 
closing.cpp:21: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   21 | #pragma GCC optimization ("unroll-loops")
      | 
/usr/bin/ld: /tmp/ccMnCD8B.o: in function `main':
grader.cpp:(.text.startup+0x6a1): undefined reference to `max_score(int, int, int, long long, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status