結果
問題 | No.154 市バス |
ユーザー |
![]() |
提出日時 | 2016-09-11 15:05:40 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 1,228 bytes |
コンパイル時間 | 1,595 ms |
コンパイル使用メモリ | 32,124 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 08:43:11 |
合計ジャッジ時間 | 1,076 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 |
ソースコード
program mainimplicit noneinteger::T,icharacter*1000::Sread *,Tdo i=1,Tread *,Scall analyze(S)end docontainssubroutine analyze(S)integer::j,len,w,g,r,keitoucharacter*1000::Slen = LEN_TRIM(S)w = 0g = 0r = 0do j=1,lenif(S(j:j).eq.'R') thenr = r + 1if(r.gt.g.or.r.gt.w) thenprint '(a)',"impossible"returnend ifelse if(S(j:j).eq.'G') theng = g + 1if(g.gt.w) thenprint '(a)',"impossible"returnend ifelsew = w + 1end ifend doif(g.ne.r) thenprint '(a)',"impossible"returnend ifw = 0g = 0r = 0do j=len,1,-1if(S(j:j).eq.'R') thenr = r + 1else if(S(j:j).eq.'G') theng = g + 1if(r.eq.0) thenprint '(a)',"impossible"returnend ifelsew = w + 1if(r.eq.0.or.g.eq.0) thenprint '(a)',"impossible"returnend ifend ifend doprint '(a)',"possible"end subroutine analyzeend program main