Submission #944201

# Submission time Handle Problem Language Result Execution time Memory
944201 2024-03-12T09:58:50 Z beepbeepsheep Meetings (IOI18_meetings) C++17
0 / 100
246 ms 2172 KB
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

#define ll long long
const ll inf=1e18;

std::vector<long long> __attribute__((optimize("O3","unroll-loops"),
                        target("arch=sandybridge"),
                        target("avx,avx2,fma"))) minimum_costs(std::vector<int> H, std::vector<int> L,
                                     std::vector<int> R) {
    ll n=H.size();
    ll q=L.size();
    vector<ll> ans;
    int *h,*l,*r;
    h=new int[n];
    l=new int[q];
    r=new int[q];
    for (int i=0;i<n;i++) h[i]=H[i];
    for (int i=0;i<q;i++) l[i]=L[i];
    for (int i=0;i<q;i++) r[i]=R[i];
    for (int i=0;i<q;i++){
        int tot=0,cnt=0;
        for (int j=l[i];j<=r[i];j++){
            cnt+=2-h[j];
            if (h[j]==2 & cnt) tot=max(tot,cnt),cnt=0;
        }
        if (tot<cnt) tot=cnt;
        ans.emplace_back((r[i]-l[i]+1)*2-tot);
    }
    return ans;
}

Compilation message

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:28:21: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   28 |             if (h[j]==2 & cnt) tot=max(tot,cnt),cnt=0;
      |                 ~~~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 246 ms 2172 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 246 ms 2172 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -