MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / main

Method main

src/class151/Code02_Treap1.java:207–236  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

205 }
206
207 public static void main(String[] args) throws IOException {
208 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
209 StreamTokenizer in = new StreamTokenizer(br);
210 PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
211 in.nextToken();
212 int n = (int) in.nval;
213 for (int i = 1, op, x; i <= n; i++) {
214 in.nextToken();
215 op = (int) in.nval;
216 in.nextToken();
217 x = (int) in.nval;
218 if (op == 1) {
219 add(x);
220 } else if (op == 2) {
221 remove(x);
222 } else if (op == 3) {
223 out.println(rank(x));
224 } else if (op == 4) {
225 out.println(index(x));
226 } else if (op == 5) {
227 out.println(pre(x));
228 } else {
229 out.println(post(x));
230 }
231 }
232 clear();
233 out.flush();
234 out.close();
235 br.close();
236 }
237
238}

Callers

nothing calls this directly

Calls 10

addMethod · 0.95
removeMethod · 0.95
rankMethod · 0.95
indexMethod · 0.95
preMethod · 0.95
postMethod · 0.95
clearMethod · 0.95
printlnMethod · 0.45
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected