twitu's blog

By twitu, history, 7 years ago, In English

I have a library of data structures I commonly use, however I find it difficult to use them on codeforces because it requires one pubic class only. There are other editors however that support multiple classes.

This my programme structure:
~~~~~
class Digraph {}
class Bag {} // Bag is used by Digraph
public class {
static digraph
// declare other static variables
static recursivefunction () // operates on digraph
static solution () // computes and prints solution and calls recursive function, instantiate digraph
static void main() // calls solution
}
~~~~~
The problem came up because codeforces judge would accept only one public class

So i tried this:
~~~~~
public class { class Digraph {}
class Bag {} // Bag is used by Digraph
static digraph
// declare other static variables
static recursivefunction () // operates on digraph
static solution () // computes and prints solution and calls recursive function, instantiate digraph
static void main() // calls solution
}
~~~~~
This gives an error that when declaring digraph because Main.this.Digraph cannot be accessed from a static context.

So, how do i use classes in a conflict free manner. Your answer would be of great help.

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it