結果
| 問題 | 
                            No.3109 Swap members
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tnakao0123
                         | 
                    
| 提出日時 | 2025-04-19 18:08:20 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 177 ms / 2,000 ms | 
| コード長 | 662 bytes | 
| コンパイル時間 | 882 ms | 
| コンパイル使用メモリ | 72,488 KB | 
| 実行使用メモリ | 13,824 KB | 
| 最終ジャッジ日時 | 2025-04-19 18:08:28 | 
| 合計ジャッジ時間 | 5,776 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 52 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:29:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   29 |   scanf("%d%d", &n, &k);
      |   ~~~~~^~~~~~~~~~~~~~~~
main.cpp:34:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   34 |     scanf("%s", s);
      |     ~~~~~^~~~~~~~~
main.cpp:40:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   40 |     scanf("%s", t);
      |     ~~~~~^~~~~~~~~
            
            ソースコード
/* -*- coding: utf-8 -*-
 *
 * 3109.cc:  No.3109 Swap members - yukicoder
 */
#include<cstdio>
#include<string>
#include<map>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_L = 32;
/* typedef */
using msi = map<string,int>;
/* global variables */
/* subroutines */
/* main */
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  msi sis;
  for (int i = 0; i < n; i++) {
    char s[MAX_L + 4];
    scanf("%s", s);
    sis[string(s)] = i;
  }
  for (int i = 0; i < n; i++) {
    char t[MAX_L + 4];
    scanf("%s", t);
    if (abs(i - sis[string(t)]) % k != 0) {
      puts("No"); return 0;
    }
  }
  puts("Yes");
  return 0;
}
            
            
            
        
            
tnakao0123