/* * Solution Template for Robot Writing * * Australian Informatics Olympiad 2025 * * This file is provided to assist with reading of input and writing of output * for the problem. You may modify this file however you wish, or * you may choose not to use this file at all. */ import java.io.*; class Solution { /* N is the number of tiles. */ private static int N; /* * T contains the values on the tiles. Note that the array starts from 0, and * so the values are T[0] to T[N-1]. */ private static int T[] = new int[200005]; /* M is the length of target sequence. */ private static int M; /* * S contains the target sequence. Note that the array starts from 0, and so * the values are S[0] to S[M-1]. */ private static int S[] = new int[200005]; /* * Read the next token from the input file. * Tokens are separated by whitespace, i.e., spaces, tabs and newlines. * If end-of-file is reached then an empty string is returned. */ private static String readToken(BufferedReader in) throws IOException { StringBuffer ans = new StringBuffer(); int next; /* Skip any initial whitespace. */ next = in.read(); while (next >= 0 && Character.isWhitespace((char)next)) next = in.read(); /* Read the following token. */ while (next >= 0 && ! Character.isWhitespace((char)next)) { ans.append((char)next); next = in.read(); } return ans.toString(); } public static void main(String[] args) throws IOException { /* Open the input and output streams for stdin and stdout. */ BufferedReader input_reader = new BufferedReader(new InputStreamReader( System.in)); BufferedWriter output_writer = new BufferedWriter(new OutputStreamWriter( System.out)); /* Read the values of N, S, M, and T. */ N = Integer.parseInt(readToken(input_reader)); for (int i = 0; i < N; i++) { T[i] = Integer.parseInt(readToken(input_reader)); } M = Integer.parseInt(readToken(input_reader)); for (int i = 0; i < M; i++) { S[i] = Integer.parseInt(readToken(input_reader)); } /* * TODO: This is where you should compute your solution. You should output * YES or NO depending on whether it is possible for the robot to output * the target sequence. An example of how to output YES is shown below. */ output_writer.write("YES\n"); /* Close the input_reader and output_writer. */ input_reader.close(); output_writer.close(); } }