Submission #14088
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #define rep(i,l,r)for(int i=l;i<r;i++) #define minm(p,q)(~p&&p<q?p:q) char s[60][60]; n,m,cnt,ans=-1; main(){ scanf ( "%d%d\n" ,&n,&m); rep(i,0,n) gets (s[i]); rep(i,0,n-2)rep(j,i+1,n-1){ cnt=0; rep(a,0,n)rep(b,0,m){ if (a<=i)cnt+=s[a][b]!= 'W' ; else if (a<=j)cnt+=s[a][b]!= 'B' ; else cnt+=s[a][b]!= 'R' ; } ans=minm(ans,cnt); } printf ( "%d\n" ,ans); } |
ステータス
項目 | データ |
---|---|
問題 | 0259 - ロシアの旗 (Russian Flag) |
ユーザー名 | sugar |
投稿日時 | 2017-04-08 02:33:54 |
言語 | C |
状態 | Accepted |
得点 | 5 |
ソースコード長 | 370 Byte |
最大実行時間 | 51 ms |
最大メモリ使用量 | 536 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | INPUT1 | 1 / 1 | *in1.txt |
2 | INPUT2 | 1 / 1 | *in2.txt |
3 | INPUT3 | 1 / 1 | *in3.txt |
4 | INPUT4 | 1 / 1 | *in4.txt |
5 | INPUT5 | 1 / 1 | *in5.txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | ||||
---|---|---|---|---|---|---|---|---|
2016-yo-t3-in1.txt | AC | 32 ms | 480 KB |
1
|
||||
2016-yo-t3-in2.txt | AC | 30 ms | 536 KB |
2
|
||||
2016-yo-t3-in3.txt | AC | 42 ms | 496 KB |
3
|
||||
2016-yo-t3-in4.txt | AC | 51 ms | 432 KB |
4
|
||||
2016-yo-t3-in5.txt | AC | 20 ms | 460 KB |
5
|
||||
2016-yo-t3-in_s1.txt | AC | 17 ms | 420 KB | |||||
2016-yo-t3-in_s2.txt | AC | 24 ms | 452 KB |