Submission #57302


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long
struct IoSetup {
IoSetup() {
cin.tie(0);
ios::sync_with_stdio(false);
cout << fixed << setprecision(10);
cerr << fixed << setprecision(10);
}
}IoSetup;
typedef long long ll;
typedef pair < int , int > pii;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 998244353;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};
bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
signed main() {
int n, m;
cin >> n>> m ;
string mas[100];
for(int i = 0; i < n; i++) {
cin >> mas[i];
}
int mini = INF;
int tmp;
for(int i = 1; i <= n-2; i++) {
for(int j = i+1; j <= n-1; j++) {
tmp = 0;
for(int k = 0; k < n; k++) {
for(int l = 0; l < m; l++) {
if(k<i ){
if(mas[k][l]!='W'){
tmp++;
}
}
else if(k<j){
if(mas[k][l]!='B'){
tmp++;
}
}
else {
if(mas[k][l]!='R'){
tmp++;
}
}
}
}
chmin(mini,tmp);
}
}
cout << mini << endl;
return 0;
}

ステータス

項目 データ
問題 0259 - ロシアの旗 (Russian Flag)
ユーザー名 ei1821
投稿日時 2019-12-12 18:23:55
言語 C++14
状態 Accepted
得点 5
ソースコード長 1604 Byte
最大実行時間 23 ms
最大メモリ使用量 612 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 23 ms 604 KB
1
2016-yo-t3-in2.txt AC 20 ms 432 KB
2
2016-yo-t3-in3.txt AC 22 ms 392 KB
3
2016-yo-t3-in4.txt AC 22 ms 468 KB
4
2016-yo-t3-in5.txt AC 21 ms 412 KB
5
2016-yo-t3-in_s1.txt AC 23 ms 612 KB
2016-yo-t3-in_s2.txt AC 21 ms 572 KB