QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#580240#8936. Team ArrangementForever_Young#Compile Error//C++141.5kb2024-09-21 20:40:142024-09-21 20:40:14

Judging History

This is the latest submission verdict.

  • [2024-09-21 20:40:14]
  • Judged
  • [2024-09-21 20:40:14]
  • Submitted

answer

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
const int inf=800000000;
int n,w[66],tail,num[66],f[66],res,g;
vector<int> r[66];
bitset<66> q;
int work(){
    num[tail]=0;
    q.reset();
    for (int i=1;i<=n;i++) f[i]=0;
    for (int i=tail-1;i>=0;i--){
        //printf("who:%d\n",num[i]);
        for (int j=num[i+1]+1;j<=num[i];j++){
            for (int k=0;k<r[j].size();k++){
                q.set(r[j][k]);
                f[r[j][k]]++;
            }
        }
        int tmp=num[i];
        while (tmp){
            int now=q._Find_next(num[i]-1);
            //printf("    %d\n",now);
            if (now==66) return 0;
            f[now]--;
            if (f[now]==0) q.reset(now);
            tmp--;
        }
    }
    return 1;
}
void dfs(int x,int y){
    if (x<0||y==0) return;
    if (x==0){
        if (g>res&&work()) res=g;
        return;
    }
    num[tail++]=y;
    g+=w[y];
    dfs(x-y,y);
    tail--;
    g-=w[y];
    dfs(x,y-1);
}
int main(){
    scanf("%d",&n);
    res=-inf;
    for (int i=0;i<n;i++){
        int o,p;
        scanf("%d%d",&o,&p);
        r[o].push_back(p);
    }
    for (int i=1;i<=n;i++) scanf("%d",&w[i]);
    dfs(n,n);
    if (res==-inf) printf("impossible\n");
    else printf("%d\n",res);
    //for (int i=0;i<n;i++) scanf("%d%d",&a[i].fi,&a[i].se);

    //for (int i=0;i<n;i++) scanf("%d",&w[i]);
}

Details

answer.code: In function ‘int main()’:
answer.code:50:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   50 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
answer.code:54:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   54 |         scanf("%d%d",&o,&p);
      |         ~~~~~^~~~~~~~~~~~~~
answer.code:57:33: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   57 |     for (int i=1;i<=n;i++) scanf("%d",&w[i]);
      |                            ~~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from answer.code:4:
/usr/include/c++/13/bits/allocator.h: In destructor ‘std::_Vector_base<int, std::allocator<int> >::_Vector_impl::~_Vector_impl()’:
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = int]’: target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/queue:63,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:157:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~