fork download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4.  
  5. namespace FTTH.LIB
  6. {
  7. public class InputDataRaw
  8. {
  9. public int noOfLayers;
  10. public int treeSize;
  11.  
  12. public List<int>[] sons;
  13.  
  14. public int[] parent;
  15.  
  16. public double[] distToParent;
  17. public int[] demand;
  18.  
  19. public double[] layerCost;
  20. public int[] concentrationLimit;
  21.  
  22. public int[,] fiberLimit;
  23.  
  24. public InputDataRaw ()
  25. {
  26.  
  27. sons = new List<int>[12] {
  28. new List<int> (),
  29. new List<int>{ 2, 3 },
  30. new List<int>{ 4, 5 },
  31. new List<int>{ 6, 7 },
  32. new List<int> {
  33. 8,
  34. 9
  35. },
  36. new List<int> {
  37. 10,
  38. 11
  39. },
  40. new List<int> (),
  41. new List<int> (),
  42. new List<int> (),
  43. new List<int> (),
  44. new List<int> (),
  45. new List<int> ()
  46. };
  47.  
  48. }
  49. private void DFS(int node,int k, int[] tab, int layer, String filename)
  50. {
  51.  
  52. string str = "";
  53. for (int i = 0; i < layer; i++)
  54. str += "\t";
  55. str += ("[");
  56. for(int i = 0; i < k-1; i++)
  57. str += (tab[node * k + i].ToString() + " ");
  58. str += (tab[node * k + k - 1].ToString() + "]");
  59. System.IO.StreamWriter file = new System.IO.StreamWriter ("filename");
  60. file.WriteLine(str);
  61.  
  62. if(sons[node].Count > 0)
  63. {
  64. foreach (int son in sons[node])
  65. {
  66. DFS(son, k, tab, layer + 1, filename);
  67. }
  68. }
  69. }
  70. public static void Main (string[] args)
  71. {
  72. int[] tab = new int[12] {25, 20, 10, 5,0,0,0,0,0,0,0,0};
  73. InputDataRaw x = new InputDataRaw() ;
  74. x.DFS(1,1,tab,0,"d");
  75. }
  76. }
  77. }
Runtime error #stdin #stdout #stderr 0.01s 135040KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Unhandled Exception:
System.UnauthorizedAccessException: Access to the path "/home/Ws00YA/filename" is denied.
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0025f] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)
  at System.IO.StreamWriter.CreateFile (System.String path, System.Boolean append, System.Boolean checkHost) [0x00022] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize, System.Boolean checkHost) [0x00061] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize) [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.IO.StreamWriter..ctor (System.String path) [0x00008] in <8f2c484307284b51944a1a13a14c0266>:0 
  at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string)
  at FTTH.LIB.InputDataRaw.DFS (System.Int32 node, System.Int32 k, System.Int32[] tab, System.Int32 layer, System.String filename) [0x0008b] in <9bec0c99dccd46fabdd29c41d0d9f0ae>:0 
  at FTTH.LIB.InputDataRaw.Main (System.String[] args) [0x00019] in <9bec0c99dccd46fabdd29c41d0d9f0ae>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.UnauthorizedAccessException: Access to the path "/home/Ws00YA/filename" is denied.
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0025f] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)
  at System.IO.StreamWriter.CreateFile (System.String path, System.Boolean append, System.Boolean checkHost) [0x00022] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize, System.Boolean checkHost) [0x00061] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize) [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 
  at System.IO.StreamWriter..ctor (System.String path) [0x00008] in <8f2c484307284b51944a1a13a14c0266>:0 
  at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string)
  at FTTH.LIB.InputDataRaw.DFS (System.Int32 node, System.Int32 k, System.Int32[] tab, System.Int32 layer, System.String filename) [0x0008b] in <9bec0c99dccd46fabdd29c41d0d9f0ae>:0 
  at FTTH.LIB.InputDataRaw.Main (System.String[] args) [0x00019] in <9bec0c99dccd46fabdd29c41d0d9f0ae>:0