結果
| 問題 | No.1439 Let's Compare!!!! | 
| コンテスト | |
| ユーザー |  fukafukatani | 
| 提出日時 | 2021-04-03 10:55:13 | 
| 言語 | Rust (1.83.0 + proconio) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 479 ms / 2,000 ms | 
| コード長 | 1,949 bytes | 
| コンパイル時間 | 16,028 ms | 
| コンパイル使用メモリ | 378,936 KB | 
| 実行使用メモリ | 21,156 KB | 
| 最終ジャッジ日時 | 2024-12-24 13:56:16 | 
| 合計ジャッジ時間 | 22,211 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 17 | 
コンパイルメッセージ
warning: unused variable: `i`
  --> src/main.rs:31:9
   |
31 |     for i in 0..q {
   |         ^ help: if this is intentional, prefix it with an underscore: `_i`
   |
   = note: `#[warn(unused_variables)]` on by default
            
            ソースコード
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;
use std::ops::Bound::*;
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}
fn main() {
    let n = read::<usize>();
    let mut s = read::<String>()
        .chars()
        .map(|x| x.to_digit(10).unwrap())
        .collect::<Vec<_>>();
    let mut t = read::<String>()
        .chars()
        .map(|x| x.to_digit(10).unwrap())
        .collect::<Vec<_>>();
    let q = read::<usize>();
    let mut queries = vec![];
    for i in 0..q {
        let v = read_vec::<String>();
        let x = v[1].parse::<usize>().unwrap() - 1;
        let y = v[2].parse::<u32>().unwrap();
        queries.push((v[0].clone(), x, y));
    }
    let mut diffs = BTreeSet::new();
    for i in 0..n {
        if s[i] != t[i] {
            diffs.insert(i);
        }
    }
    for (v, x, y) in queries {
        if v == "S" {
            s[x] = y;
        } else {
            t[x] = y;
        }
        if s[x] == t[x] {
            if diffs.contains(&x) {
                diffs.remove(&x);
            }
        } else {
            if !diffs.contains(&x) {
                diffs.insert(x);
            }
        }
        if let Some(&i) = diffs.iter().next() {
            if s[i] > t[i] {
                println!(">");
            } else {
                println!("<");
            }
        } else {
            println!("=");
        }
    }
}
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
            
            
            
        