QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#611708 | #8790. First Billion | ZhenAn9052 | Compile Error | / | / | C++14 | 692b | 2024-10-04 22:14:24 | 2024-10-04 22:14:25 |
Judging History
answer
#include <cstdio>
#include <utility>
#include <algorithm>
using namespace std;
const int N=100,M=1e9;
int n;
pair<int,int>a[N+5];
int num[N+5];
bool flag;
void dfs(int now,int cnt,int sum){
if(flag)return;
if(sum>M)return;
if(M-sum>(n-now+1ll)*a[now].first)return;
if(now>n){
if(sum!=M)return;
printf("%d ",cnt);flag=1;
for(int i=1;i<=cnt;++i)printf("%d ",num[i]);
return;
}
for(int i=now;i<=n;++i){
num[cnt+1]=a[i].second;
dfs(i+1,cnt+1,sum+a[i].first);
}
}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;++i){
scanf("%d",&a[i].first);
a[i].second=i;tmp[i]=a[i].first;
}
sort(a+1,a+n+1);reverse(a+1,a+n+1);
dfs(1,0,0);
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:29:31: error: ‘tmp’ was not declared in this scope 29 | a[i].second=i;tmp[i]=a[i].first; | ^~~ answer.code:26:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | scanf("%d",&n); | ~~~~~^~~~~~~~~ answer.code:28:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | scanf("%d",&a[i].first); | ~~~~~^~~~~~~~~~~~~~~~~~