結果
| 問題 |
No.3109 Swap members
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-21 21:37:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 196 ms / 2,000 ms |
| コード長 | 519 bytes |
| コンパイル時間 | 1,874 ms |
| コンパイル使用メモリ | 202,812 KB |
| 実行使用メモリ | 28,516 KB |
| 最終ジャッジ日時 | 2025-04-21 21:37:41 |
| 合計ジャッジ時間 | 7,544 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#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;
}