Submission #00033
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #include<iostream> #include<stdbool.h> using namespace std; typedef struct { int par,left,right; }node; //par=parent,left=child,right=sibling node tree[505]; bool list[505]; void treeserch( int now, int time ){ if ( time ==3||now==-1) return 0; if (list[now]==0) list[now]=1; treeserch(tree[now].left, time +1)+treeserch(tree[now].right, time ); return ; } int main(){ int n,m; int a,b; cin >> n >> m; for ( int i=0;i<=n;i++){ tree[i]=(node){-1,-1,-1}; list[i]=0; } for ( int i=0;i<m;i++){ cin >> a >> b; if (tree[a].left!=-1){ int c=tree[a].left; while (tree[c].right!=-1) c=tree[c].right; tree[c].right=b; } else tree[a].left=b; } treeserch(1,0); int ans=0; for ( int i=1;i<n;i++){ if (list[i]) ans++; } cout << ans-1 << endl; //id:1 delete return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0001 - パーティ |
ユーザー名 | ei1710 |
投稿日時 | 2017-11-04 15:59:32 |
言語 | C++ |
状態 | Compile Error |
得点 | 0 |
ソースコード長 | 886 Byte |
最大実行時間 | - |
最大メモリ使用量 |
コンパイルメッセージ
./Main.cpp:45:1: error: stray ‘\343’ in program return 0; ^ ./Main.cpp:45:1: error: stray ‘\200’ in program ./Main.cpp:45:1: error: stray ‘\200’ in program ./Main.cpp: In function ‘void treeserch(int, int)’: ./Main.cpp:13:12: error: return-statement with a value, in function returning 'void' [-fpermissive] return 0; ^ ./Main.cpp:16:66: error: invalid operands of types ‘void’ and ‘void’ to binary ‘operator+’ treeserch(tree[now].left,time+1)+treeserch(tree[now].right,time); ^
セット
セット | 得点 | Cases |
---|
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|