結果

問題 No.69 文字を自由に並び替え
ユーザー alpha_virginisalpha_virginis
提出日時 2015-05-24 15:32:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 625 bytes
コンパイル時間 1,661 ms
コンパイル使用メモリ 144,852 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-20 22:59:54
合計ジャッジ時間 2,049 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 2 ms
4,384 KB
testcase_14 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

inline long nextInt(void) {
  long temp;
  std::cin >> temp;
  return temp;
}

int main() {

  int c1[256] = {};
  int c2[256] = {};
  std::string str1;
  std::string str2;
  bool b = true;

  std::cin >> str1;
  std::cin >> str2;

  for(int i = 0; i < str1.size(); ++i) {
    ++c1[str1[i]];
  }
  for(int i = 0; i < str2.size(); ++i) {
    ++c2[str2[i]];
  }

  b = true;
  for(int i = 0; i < 256; ++i) {
    if( c1[i] != c2[i] ) {
      b = false;
      break;
    }
  }

  if( b ) {
    std::cout << "YES" << std::endl;
  }
  else {
    std::cout << "NO" << std::endl;
  }
  
    
  return 0;
}

0