Submission #7779
Source Code Expand
#include <cstdio> #include <string> #include <algorithm> using namespace std; void strReplace (string& str, const string& from, const string& to) { string::size_type pos = 0; while(pos = str.find(from, pos), pos != string::npos) { str.replace(pos, from.length(), to); pos += to.length(); } } int get(char* s) { int res=11111; string pt="ABXY"; for(int i=0;i<4;i++){ for(int j=0;j<4;j++){ for(int k=0;k<4;k++){ for(int l=0;l<4;l++){ string t=s; strReplace(t,pt.substr(i,1)+pt.substr(j,1),"L"); strReplace(t,pt.substr(k,1)+pt.substr(l,1),"L"); res=min<int>(res,t.size()); } } } } return res; } int main(void) { int n; char buf[1111]; scanf("%d",&n); scanf("%s",buf); printf("%d\n",get(buf)); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - コマンド入力 |
User | roxion1377 |
Language | C++ (GCC 4.4.7) |
Score | 100 |
Code Size | 864 Byte |
Status | AC |
Exec Time | 27 ms |
Memory | 884 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result ./Main.cpp:35: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00_retmax.txt, 00_retmin.txt, 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_rnd_00.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 01_rnd_11.txt, 01_rnd_12.txt, 01_rnd_13.txt, 01_rnd_14.txt, 01_rnd_15.txt, 01_rnd_16.txt, 01_rnd_17.txt, 01_rnd_18.txt, 01_rnd_19.txt, 02_twothree_00.txt, 02_twothree_01.txt, 02_twothree_02.txt, 02_twothree_03.txt, 02_twothree_04.txt, 02_twothree_05.txt, 02_twothree_06.txt, 02_twothree_07.txt, 02_twothree_08.txt, 02_twothree_09.txt, 02_twothree_10.txt, 02_twothree_11.txt, 02_twothree_12.txt, 02_twothree_13.txt, 02_twothree_14.txt, 02_twothree_15.txt, 02_twothree_16.txt, 02_twothree_17.txt, 02_twothree_18.txt, 02_twothree_19.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_retmax.txt | AC | 24 ms | 788 KB |
00_retmin.txt | AC | 20 ms | 788 KB |
00_sample_00.txt | AC | 21 ms | 784 KB |
00_sample_01.txt | AC | 21 ms | 788 KB |
00_sample_02.txt | AC | 21 ms | 772 KB |
01_rnd_00.txt | AC | 27 ms | 796 KB |
01_rnd_01.txt | AC | 26 ms | 792 KB |
01_rnd_02.txt | AC | 27 ms | 820 KB |
01_rnd_03.txt | AC | 26 ms | 792 KB |
01_rnd_04.txt | AC | 27 ms | 768 KB |
01_rnd_05.txt | AC | 26 ms | 792 KB |
01_rnd_06.txt | AC | 26 ms | 792 KB |
01_rnd_07.txt | AC | 26 ms | 796 KB |
01_rnd_08.txt | AC | 26 ms | 780 KB |
01_rnd_09.txt | AC | 26 ms | 792 KB |
01_rnd_10.txt | AC | 27 ms | 788 KB |
01_rnd_11.txt | AC | 26 ms | 796 KB |
01_rnd_12.txt | AC | 27 ms | 784 KB |
01_rnd_13.txt | AC | 27 ms | 788 KB |
01_rnd_14.txt | AC | 26 ms | 884 KB |
01_rnd_15.txt | AC | 26 ms | 780 KB |
01_rnd_16.txt | AC | 25 ms | 792 KB |
01_rnd_17.txt | AC | 26 ms | 760 KB |
01_rnd_18.txt | AC | 27 ms | 780 KB |
01_rnd_19.txt | AC | 26 ms | 788 KB |
02_twothree_00.txt | AC | 25 ms | 784 KB |
02_twothree_01.txt | AC | 25 ms | 788 KB |
02_twothree_02.txt | AC | 25 ms | 792 KB |
02_twothree_03.txt | AC | 26 ms | 796 KB |
02_twothree_04.txt | AC | 25 ms | 796 KB |
02_twothree_05.txt | AC | 25 ms | 764 KB |
02_twothree_06.txt | AC | 25 ms | 820 KB |
02_twothree_07.txt | AC | 26 ms | 784 KB |
02_twothree_08.txt | AC | 25 ms | 788 KB |
02_twothree_09.txt | AC | 25 ms | 780 KB |
02_twothree_10.txt | AC | 25 ms | 788 KB |
02_twothree_11.txt | AC | 25 ms | 792 KB |
02_twothree_12.txt | AC | 25 ms | 788 KB |
02_twothree_13.txt | AC | 25 ms | 788 KB |
02_twothree_14.txt | AC | 25 ms | 792 KB |
02_twothree_15.txt | AC | 25 ms | 784 KB |
02_twothree_16.txt | AC | 25 ms | 784 KB |
02_twothree_17.txt | AC | 25 ms | 792 KB |
02_twothree_18.txt | AC | 25 ms | 784 KB |
02_twothree_19.txt | AC | 25 ms | 788 KB |