Pagini recente » Cod sursa (job #1294368) | Cod sursa (job #740438) | Cod sursa (job #620279) | Cod sursa (job #1314382) | Cod sursa (job #3242285)
//package hashuri;
import java.io.*;
import java.util.*;
public class Main {
static final String INPUT_FILE = "hashuri.in";
static final String OUTPUT_FILE = "hashuri.out";
public static class TokenizedReader {
private final BufferedReader reader;
private StringTokenizer tokenizer;
TokenizedReader(String filePath) throws FileNotFoundException {
reader = new BufferedReader(new FileReader(filePath));
}
private String nextToken() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
private int nextInt() {
return Integer.parseInt(nextToken());
}
public void close() throws IOException {
reader.close();
}
}
public static void main(String[] args) throws IOException {
TokenizedReader reader = new TokenizedReader(INPUT_FILE);
PrintWriter writer = new PrintWriter(OUTPUT_FILE);
solve(reader, writer);
reader.close();
writer.flush();
writer.close();
}
public static void solve(TokenizedReader reader,
PrintWriter writer) {
int n = reader.nextInt();
Set<Integer> map = new HashSet<>();
while (n-- > 0) {
int op = reader.nextInt();
int el = reader.nextInt();
if (op == 1) {
map.add(el);
} else if (op == 2) {
map.remove(el);
} else if (op == 3) {
writer.println(map.contains(el) ? 1 : 0);
}
}
}
}