結果

問題 No.1439 Let's Compare!!!!
ユーザー tentententen
提出日時 2024-02-07 13:17:46
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 2,225 bytes
コンパイル時間 2,917 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 71,664 KB
最終ジャッジ日時 2024-02-07 13:17:59
合計ジャッジ時間 13,414 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
61,692 KB
testcase_01 AC 79 ms
55,016 KB
testcase_02 AC 80 ms
54,904 KB
testcase_03 AC 83 ms
55,116 KB
testcase_04 AC 85 ms
55,008 KB
testcase_05 AC 84 ms
55,128 KB
testcase_06 AC 81 ms
54,856 KB
testcase_07 AC 158 ms
56,420 KB
testcase_08 AC 166 ms
58,752 KB
testcase_09 AC 138 ms
56,272 KB
testcase_10 AC 549 ms
65,516 KB
testcase_11 AC 573 ms
65,848 KB
testcase_12 AC 573 ms
65,772 KB
testcase_13 AC 543 ms
65,488 KB
testcase_14 AC 558 ms
65,544 KB
testcase_15 AC 569 ms
65,900 KB
testcase_16 AC 567 ms
65,588 KB
testcase_17 AC 561 ms
65,612 KB
testcase_18 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        char[][] strings = new char[2][];
        for (int i = 0; i < 2; i++) {
            strings[i] = sc.next().toCharArray();
        }
        Map<String, Integer> idxes = Map.of("S", 0, "T", 1);
        int[] diff = {0};
        while (diff[0] < n && strings[0][diff[0]] == strings[1][diff[0]]) {
            diff[0]++;
        }
        int q = sc.nextInt();
        String result = IntStream.range(0, q).mapToObj(i -> {
            int x = idxes.get(sc.next());
            int positon = sc.nextInt() - 1;
            char c = (char)(sc.nextInt() + '0');
            strings[x][positon] = c;
            if (positon <= diff[0]) {
                diff[0] = positon;
                while (diff[0] < n && strings[0][diff[0]] == strings[1][diff[0]]) {
                    diff[0]++;
                }
            }
            if (diff[0] == n) {
                return "=";
            } else if (strings[0][diff[0]] < strings[1][diff[0]]) {
                return "<";
            } else {
                return ">";
            }
        }).collect(Collectors.joining("\n"));
        System.out.println(result);
    }
}
class Scanner {
    BufferedReader br;
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
        } catch (Exception e) {
            
        }
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    
    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    
    public String next() {
        try {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            return st.nextToken();
        }
    }
    
}
0