Submission #1083790

# Submission time Handle Problem Language Result Execution time Memory
1083790 2024-09-04T07:20:39 Z bvd Bitaro the Brave (JOI19_ho_t1) C++14
Compilation error
0 ms 0 KB
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class joi2019_ho_t1 {
	private static class Kattio extends PrintWriter {
		public Kattio(InputStream i) {
			super(new BufferedOutputStream(System.out));
			r = new BufferedReader(new InputStreamReader(i));
		}

		public Kattio(InputStream i, OutputStream o) {
			super(new BufferedOutputStream(o));
			r = new BufferedReader(new InputStreamReader(i));
		}

		public boolean hasMoreTokens() {
			return peekToken() != null;
		}

		public int getInt() {
			return Integer.parseInt(nextToken());
		}

		public double getDouble() {
			return Double.parseDouble(nextToken());
		}

		public long getLong() {
			return Long.parseLong(nextToken());
		}

		public String getWord() {
			return nextToken();
		}

		private BufferedReader r;
		private String line;
		private StringTokenizer st;
		private String token;

		private String peekToken() {
			if (token == null)
				try {
					while (st == null || !st.hasMoreTokens()) {
						line = r.readLine();
						if (line == null)
							return null;
						st = new StringTokenizer(line);
					}
					token = st.nextToken();
				} catch (IOException e) {
				}
			return token;
		}

		private String nextToken() {
			String ans = peekToken();
			token = null;
			return ans;
		}
	}
	
	public static void main(String[] args) {
		try (Kattio io = new Kattio(System.in, System.out)) {
			int n = io.getInt();
			int m = io.getInt();
			String[] table = new String[m];
			for (int i=0; i<n; ++i) {
				table[i] = io.getWord();
			}
			
			int[] cntRow = new int[m];
			int[] cntCol = new int[n];
			long result = 0;
			for (int i=n-1; i>=0; --i) {
				for (int j=m-1; j>=0; --j) {
					switch (table[i].charAt(j)) {
						case 'O': cntCol[i]++; break;
						case 'I': cntRow[j]++; break;
						default: result += cntRow[j] * cntCol[i];
					}
				}
			}
			
			io.println(result);
		}
	}
}

Compilation message

joi2019_ho_t1.cpp:1:1: error: 'import' does not name a type
    1 | import java.io.BufferedOutputStream;
      | ^~~~~~
joi2019_ho_t1.cpp:2:1: error: 'import' does not name a type
    2 | import java.io.BufferedReader;
      | ^~~~~~
joi2019_ho_t1.cpp:3:1: error: 'import' does not name a type
    3 | import java.io.IOException;
      | ^~~~~~
joi2019_ho_t1.cpp:4:1: error: 'import' does not name a type
    4 | import java.io.InputStream;
      | ^~~~~~
joi2019_ho_t1.cpp:5:1: error: 'import' does not name a type
    5 | import java.io.InputStreamReader;
      | ^~~~~~
joi2019_ho_t1.cpp:6:1: error: 'import' does not name a type
    6 | import java.io.OutputStream;
      | ^~~~~~
joi2019_ho_t1.cpp:7:1: error: 'import' does not name a type
    7 | import java.io.PrintWriter;
      | ^~~~~~
joi2019_ho_t1.cpp:8:1: error: 'import' does not name a type
    8 | import java.util.StringTokenizer;
      | ^~~~~~
joi2019_ho_t1.cpp:10:1: error: expected unqualified-id before 'public'
   10 | public class joi2019_ho_t1 {
      | ^~~~~~