結果

問題 No.3109 Swap members
ユーザー vjudge1
提出日時 2025-04-21 21:37:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 519 bytes
コンパイル時間 2,368 ms
コンパイル使用メモリ 203,992 KB
実行使用メモリ 28,496 KB
最終ジャッジ日時 2025-04-21 21:37:56
合計ジャッジ時間 8,060 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 52
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d%d",&n,&k);
      |         ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3fLL;
const int MAX=1e5+10;
map<string,int> mp[MAX];
int main()
{
	int n,k,i,ok;
	string s;
	scanf("%d%d",&n,&k);
	for(i=0;i<k;i++) mp[i].clear();
	for(i=0;i<n;i++)
	{
		cin>>s;
		mp[i%k][s]++;
	}
	for(i=0;i<n;i++)
	{
		cin>>s;
		mp[i%k][s]--;
		if(mp[i%k][s]==0) mp[i%k].erase(s);
	}
	ok=1;
	for(i=0;i<k;i++)
	{
		if(mp[i].size()>0) ok=0;
	}
	if(ok) puts("Yes");
	else puts("No");
	return 0;
}
0