Submission #00045


ソースコード

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
#include<bits/stdc++.h>
using namespace std;
#define irep(i,n) for(int i=0;i<(n);i++)
#define irepy(i,n) for(int i=1;i<=(n);i++)
#define jrep(j,n) for(int j=0;i<(n);j++)
#define jrepy(j,n) for(int j=1;i<=(n);j++)
int main(){
int n,m;//宣言
string col[55]={};
int R[55]={},B[55]={},W[55]={};//カウント
int ans=0;//ANS
cin >> n >> m;//入力
for(int i=0;i<n;i++){
cin >> col[i];
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(col[i][j]=='R') R[i]++;
if(col[i][j]=='B') B[i]++;
if(col[i][j]=='W') W[i]++;
}
}
int bluenow = 0;
int rednow = 0;
for(int i=0;i<n;i++){
if(i==0){//最低一回は白で一回
ans+=R[0]+B[0];
cout<<"A"<<ans<<endl;
}
else if(i!=0 && W[i]>=B[i] && bluenow == 0 && rednow == 0 && i<=n-2){
ans+=R[i]+B[i];//現在白
cout<<"B"<<ans<<endl;
}
else if(i!=0 && W[i]<B[i] && bluenow == 0 && rednow == 0){//blueへ
bluenow = 1;
ans+=W[i]+R[i];//この時点で青は確定で一回
cout<<"C"<<ans<<endl;
}
else if(i!=0 && B[i]>R[i] && bluenow == 1 && rednow == 0){//現在青
ans+=W[i]+R[i];
cout<<"D"<<ans<<endl;
}
else if(i!=0 && B[i]<=R[i] && rednow == 0){//redへ
rednow = 1;
ans+=W[i]+B[i];
cout<<"E"<<ans<<endl;
}
else if(i!=0 && rednow != 0){
ans+=W[i]+B[i];
cout<<"F"<<ans<<endl;
}
}
cout<<ans<<endl;
return 0;
}

ステータス

項目 データ
問題 0001 - ロシアの旗 (Russian Flag)
ユーザー名 ei1913
投稿日時 2019-10-30 17:59:25
言語 C++
状態 Wrong Answer
得点 0
ソースコード長 1470 Byte
最大実行時間 31 ms
最大メモリ使用量 676 KB

セット

セット 得点 Cases
1 INPUT1 0 / 20 *in1.txt
2 INPUT2 0 / 20 *in2.txt
3 INPUT3 0 / 20 *in3.txt
4 INPUT4 0 / 20 *in4.txt
5 INPUT5 0 / 20 *in5.txt

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
2016-yo-t3-in1.txt WA 19 ms 604 KB
1
2016-yo-t3-in2.txt WA 22 ms 452 KB
2
2016-yo-t3-in3.txt WA 17 ms 420 KB
3
2016-yo-t3-in4.txt WA 20 ms 512 KB
4
2016-yo-t3-in5.txt WA 30 ms 476 KB
5
2016-yo-t3-in_s1.txt WA 19 ms 444 KB
2016-yo-t3-in_s2.txt WA 31 ms 676 KB