結果
| 問題 |
No.10 +か×か
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2021-02-19 18:27:06 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 5,000 ms |
| コード長 | 515 bytes |
| コンパイル時間 | 140 ms |
| コンパイル使用メモリ | 30,336 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-14 15:47:11 |
| 合計ジャッジ時間 | 767 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
コンパイルメッセージ
main.c:12:1: warning: return type defaults to 'int' [-Wimplicit-int]
12 | f(i,x){
| ^
main.c: In function 'f':
main.c:12:1: warning: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:12:1: warning: type of 'x' defaults to 'int' [-Wimplicit-int]
main.c:13:17: warning: 'return' with no value, in function returning non-void
13 | if(x>t) return;
| ^~~~~~
main.c:12:1: note: declared here
12 | f(i,x){
| ^
main.c:16:25: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]
16 | write(1,wbuf+1,n-1);
| ^~~~~
main.c:17:25: warning: implicit declaration of function '_exit'; did you mean '_Exit'? [-Wimplicit-function-declaration]
17 | _exit(0);
| ^~~~~
| _Exit
main.c:19:17: warning: 'return' with no value, in function returning non-void
19 | return;
| ^~~~~~
main.c:12:1: note: declared here
12 | f(i,x){
| ^
main.c:21:24: warning: 'return' with no value, in function returning non-void
21 | if(v[i<<17|x]) return;
| ^~~~~~
main.c:12:1: note: declared here
12 | f(i,x){
| ^
main.c: At top level:
main.c:29:1: warning: return type defaults to 'int' [-Wimplicit-int]
29 | main(){
| ^~~~
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
char*mmap();
#define RD(v) v=0;{int _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}
int n,t;
int a[50];
char v[51<<17];
char wbuf[50];
f(i,x){
if(x>t) return;
if(i==n){
if(x==t){
write(1,wbuf+1,n-1);
_exit(0);
}
return;
}
if(v[i<<17|x]) return;
v[i<<17|x]=1;
wbuf[i]='+';
f(i+1,x+a[i]);
wbuf[i]='*';
f(i+1,x*a[i]);
}
main(){
char*rp=mmap(0l,1l<<28,1,2,0,0ll);
RD(n);
RD(t);
for(int i=0;i<n;++i){
int RD(ai);
a[i]=ai;
}
f(1,a[0]);
}
tails