QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#580179 | #8936. Team Arrangement | Forever_Young# | Compile Error | / | / | C++14 | 1.4kb | 2024-09-21 20:23:59 | 2024-09-21 20:24:00 |
Judging History
This is the latest submission verdict.
- [2024-09-21 20:24:00]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-09-21 20:23:59]
- Submitted
answer
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#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];
priority_queue<int> q;
pair<int,int> a[66];
int work(){
num[tail]=0;
while (!q.empty()) q.pop();
for (int i=tail-1;i>=0;i--){
for (int j=num[i+1]+1;j<=num[i];j++){
for (int k=0;k<r[j].size();k++) q.push(-r[j][k]);
}
int tmp=num[i];
while (tmp&&!q.empty()){
int now=-q.top();
q.pop();
if (now>=num[i]) tmp--;
}
if (tmp>0) return 0;
}
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(){
//freopen("E.in","r",stdin);
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]);
}
详细
answer.code: In function ‘int main()’: answer.code:44:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 44 | scanf("%d",&n); | ~~~~~^~~~~~~~~ answer.code:48:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 48 | scanf("%d%d",&o,&p); | ~~~~~^~~~~~~~~~~~~~ answer.code:51:33: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 51 | 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:3: /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 | ^~~~~~~~~~~~