結果
問題 | No.225 文字列変更(medium) |
ユーザー | 184 |
提出日時 | 2015-06-12 23:16:06 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 685 bytes |
コンパイル時間 | 670 ms |
コンパイル使用メモリ | 78,624 KB |
実行使用メモリ | 5,560 KB |
最終ジャッジ日時 | 2023-09-20 21:08:35 |
合計ジャッジ時間 | 1,941 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 2 ms
4,384 KB |
testcase_03 | WA | - |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 1 ms
4,380 KB |
testcase_08 | AC | 1 ms
4,384 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
ソースコード
#include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <iostream> #include <map> #include <vector> #include <queue> #include <set> using namespace std; //namaega184 int main(){ int n,m;char s[1001],t[1001];scanf("%d%d%s%s",&n,&m,s,t); int ans=1000000000;char ss[1001]={};char *sa=s,*sb=t; if(n>m){swap(sa,sb);swap(n,m);} vector< vector<int> > v(n); for(int i=0;i<n;i++){ int num=0; for(int j=0;j<m;j++){ if(sa[i]==sb[j])v[i].push_back(j-i); } } map<int,int> mp; int mxuse=0; for(int i=0;i<n;i++){ for(int j=0;j<v[i].size();j++){ mp[v[i][j]]++; mxuse=max(mxuse,mp[v[i][j]]); } } printf("%d\n",m-mxuse); return 0; }