ã“れ㯠20XX å¹´ã®è©±ã§ã‚る.å†ç”Ÿç™ºé›»ç¶²ã«ã‚ˆã‚‹å®‰å®šã—ãŸã‚¨ãƒãƒ«ã‚®ãƒ¼ä¾›çµ¦ï¼ŒãŠã‚ˆã³æ¶²åŒ–åˆæˆç‡ƒæ–™ã®ç™ºæ˜Žã«ã‚ˆã£ã¦èˆªç©ºæ—…客数ã¯é°»ç™»ã‚Šã«å¢—åŠ ã—ãŸï¼Žã—ã‹ã—,航空機ã«ã‚ˆã‚‹ãƒ†ãƒãƒªã‚ºãƒ ã®è„…å¨ã¯ä¾ç„¶ã¨ã—ã¦å˜åœ¨ã™ã‚‹ãŸã‚,高速ã§ã‹ã¤é«˜ã„ä¿¡é ¼æ€§ã‚’ã‚‚ã¤è‡ªå‹•æ‰‹è·ç‰©æ¤œæŸ»ã‚·ã‚¹ãƒ†ãƒ ã®é‡è¦æ€§ãŒé«˜ã¾ã£ã¦ã„る.検査官ãŒå…¨éƒ¨ã®è·ç‰©ã‚’調ã¹ã‚‹ã“ã¨ã¯å®Ÿéš›å•é¡Œã¨ã—ã¦å›°é›£ã§ã‚ã‚‹ã“ã¨ã‹ã‚‰ï¼Œè‡ªå‹•æ¤œæŸ»ã«ãŠã„ã¦ç–‘ã‚ã—ã„ã¨åˆ¤æ–ã•ã‚ŒãŸæ‰‹è·ç‰©ã ã‘を検査官ã§æ”¹ã‚ã¦èª¿ã¹ã‚‹ã¨ã„ã†ä»•çµ„ã¿ã‚’æ•´ãˆãŸã„ã‚ã‘ã§ã‚る.
航空機æ¥ç•Œã‹ã‚‰ã®è¦è«‹ã‚’å—ã‘,国際客室ä¿è·ä¼šç¤¾ï¼ˆInternational Cabin Protection Company)ã§ã¯ï¼Œæ–°ãŸãªè‡ªå‹•æ¤œæŸ»ã‚·ã‚¹ãƒ†ãƒ を開発ã™ã‚‹ãŸã‚,最近ã®æ—…客ã®æ‰‹è·ç‰©ã«ã¤ã„ã¦èª¿æŸ»ã—ãŸï¼Žèª¿æŸ»ã®çµæžœï¼Œæœ€è¿‘ã®æ—…客ã®æ‰‹è·ç‰©ã«ã¯æ¬¡ã®ã‚ˆã†ãªå‚¾å‘ãŒã‚ã‚‹ã“ã¨ãŒåˆ¤æ˜Žã—ãŸï¼Ž
上記ã®èª¿æŸ»çµæžœã‚’ãµã¾ãˆã¦ï¼Œä»¥ä¸‹ã®ã‚ˆã†ãªæ‰‹è·ç‰©æ¤œæŸ»ã®ãŸã‚ã®ãƒ¢ãƒ‡ãƒ«ã‚’考案ã—ãŸï¼Žãã‚Œãžã‚Œã®æ‰‹è·ç‰©ã¯ X ç·šã«å¯¾ã—ã¦é€æ˜Žã§ã‚る直方体ã®å®¹å™¨ã ã¨ã¿ãªã™ï¼Žãã®ä¸ã«ã¯ X ç·šã«å¯¾ã—ã¦ä¸é€æ˜Žã§ã‚る複数ã®å“物ãŒå…¥ã£ã¦ã„る.ã“ã“ã§ï¼Œç›´æ–¹ä½“ã® 3 辺を x 軸,y 軸,z 軸ã¨ã™ã‚‹åº§æ¨™ç³»ã‚’考ãˆï¼Œx 軸ã¨å¹³è¡Œãªæ–¹å‘ã« X 線を照射ã—ã¦ï¼Œy-z å¹³é¢ã«æŠ•å½±ã•ã‚ŒãŸç”»åƒã‚’撮影ã™ã‚‹ï¼Žæ’®å½±ã•ã‚ŒãŸç”»åƒã¯é©å½“ãªå¤§ãã•ã®æ ¼åã«åˆ†å‰²ã•ã‚Œï¼Œç”»åƒè§£æžã«ã‚ˆã£ã¦ï¼Œãã‚Œãžã‚Œã®æ ¼åé ˜åŸŸã«æ˜ ã£ã¦ã„ã‚‹å“物ã®æ質ãŒæŽ¨å®šã•ã‚Œã‚‹ï¼Žã“ã®ä¼šç¤¾ã«ã¯éžå¸¸ã«é«˜åº¦ã®è§£æžæŠ€è¡“ãŒã‚り,æ質ã®è©³ç´°ãªé•ã„ã™ã‚‰ã‚‚解æžã™ã‚‹ã“ã¨ãŒå¯èƒ½ã§ã‚ã‚‹ã“ã¨ã‹ã‚‰ï¼Œå“物ã®æ質ã¯äº’ã„ã«ç•°ãªã‚‹ã¨è€ƒãˆã‚‹ã“ã¨ãŒã§ãる.ãªãŠï¼Œè¤‡æ•°ã®å“物㌠x 軸方å‘ã«é–¢ã—ã¦é‡ãªã£ã¦ã„ã‚‹ã¨ãã¯ï¼Œãã‚Œãžã‚Œã®æ ¼åé ˜åŸŸã«ã¤ã„ã¦æœ€ã‚‚手å‰ã«ã‚る,ã™ãªã‚ã¡ x 座標ãŒæœ€å°ã§ã‚ã‚‹å“物ã®æ質ãŒå¾—られる.ã¾ãŸï¼Œ2 ã¤ä»¥ä¸Šã®å“物㮠x 座標ãŒç‰ã—ã„ã“ã¨ã¯ãªã„ã¨ä»®å®šã™ã‚‹ï¼Ž
ã‚ãªãŸã®ä»•äº‹ã¯ï¼Œç”»åƒè§£æžã®çµæžœãŒä¸Žãˆã‚‰ã‚ŒãŸã¨ãã«ï¼Œé•·æ–¹å½¢ã§ã¯ãªã„(æ¦å™¨ã§ã‚ã‚‹ã‹ã‚‚ã—ã‚Œãªã„)å“物ãŒå…¥ã£ã¦ã„ã‚‹ã“ã¨ãŒæ–言ã§ãã‚‹ã‹ï¼Œã‚ã‚‹ã„ã¯ãã®æ‰‹è·ç‰©ã«ã¯é•·æ–¹å½¢ã®å“物以外ã®ã‚‚ã®ã¯å…¥ã£ã¦ã„ãªã„ã¨æŽ¨æ¸¬ã•ã‚Œã‚‹ã‹ã‚’判定ã™ã‚‹ãƒ—ãƒã‚°ãƒ©ãƒ を作æˆã™ã‚‹ã“ã¨ã§ã‚る.
入力ã®å…ˆé è¡Œã«ã¯å˜ä¸€ã®æ£ã®æ•´æ•°ãŒå«ã¾ã‚Œï¼Œã“ã‚Œã¯ãƒ‡ãƒ¼ã‚¿ã‚»ãƒƒãƒˆã®å€‹æ•°ã‚’表ã™ï¼Žãã‚Œãžã‚Œã®ãƒ‡ãƒ¼ã‚¿ã‚»ãƒƒãƒˆã¯æ¬¡ã®å½¢å¼ã§ä¸Žãˆã‚‰ã‚Œã‚‹ï¼Ž
H WH ã¯ç”»åƒã®ç¸¦ã®å¤§ãã•ï¼ŒW ã¯æ¨ªã®å¤§ãã•ã‚’表ã™æ•´æ•°ã§ã‚ã‚‹ (1 <= h , w <= 50).解æžçµæžœã®å„行㯠W æ–‡å—ã§æ§‹æˆã•ã‚Œã¦ãŠã‚Šï¼Œi 番目ã®æ–‡å—ã¯ï¼Œè¡Œã®å·¦ã‹ã‚‰ i 番目ã«ã‚ã‚‹æ ¼åé ˜åŸŸã«ãŠã‘る解æžçµæžœã‚’表ã™ï¼Žç‰©è³ªãŒæ¤œå‡ºã•ã‚ŒãŸæ ¼åé ˜åŸŸã«ã¤ã„ã¦ã¯ï¼Œãã®æ質ãŒè‹±å¤§æ–‡å—(A〜Z)ã«ã‚ˆã£ã¦è¡¨ã•ã‚Œã‚‹ï¼Žã“ã®ã¨ã,åŒã˜æ質ã§ã‚ã‚Œã°åŒã˜æ–‡å—ãŒï¼Œã¾ãŸç•°ãªã‚‹æ質ã§ã‚ã‚Œã°ç•°ãªã‚‹æ–‡å—ãŒç”¨ã„られる.物質ãŒæ¤œå‡ºã•ã‚Œãªã‹ã£ãŸæ ¼åé ˜åŸŸã«ã¤ã„ã¦ã¯ãƒ‰ãƒƒãƒˆï¼ˆ.)ã§è¡¨ã•ã‚Œã‚‹ï¼Ž
解æžçµæžœãã®1
解æžçµæžœãã®2
...
解æžçµæžœãã®H
ã™ã¹ã¦ã®ãƒ‡ãƒ¼ã‚¿ã‚»ãƒƒãƒˆã«ã¤ã„ã¦ï¼Œæ質ã®ç¨®é¡žã¯ 7 種類を超ãˆãªã„ã“ã¨ãŒä¿è¨¼ã•ã‚Œã¦ã„る.
ãã‚Œãžã‚Œã®ãƒ‡ãƒ¼ã‚¿ã‚»ãƒƒãƒˆã«å¯¾ã—ã¦ï¼Œé•·æ–¹å½¢ä»¥å¤–ã®å“物ãŒç¢ºå®Ÿã«å…¥ã£ã¦ã„ã‚‹ã¨ãã¯ã€ŒSUSPICIOUSã€ã‚’,ãã†ã§ãªã„ã¨ãã¯ã€ŒSAFEã€ã‚’ãã‚Œãžã‚Œ 1 è¡Œã«å‡ºåŠ›ã—ãªã•ã„.
6 1 1 . 3 3 ... .W. ... 10 10 .......... .DDDDCCC.. .DDDDCCC.. .DDDDCCC.. ADDDDCCC.. AAA..CCC.. AAABBBBC.. AAABBBB... ..BBBBB... .......... 10 10 .......... .DDDDDD... .DDDDCCC.. .DDDDCCC.. ADDDDCCC.. AAA..CCC.. AAABBBBC.. AAABBBB... ..BBBBB... .......... 10 10 R..E..C.T. R.EEE.C.T. .EEEEE.... EEEEEEE... .EEEEEEE.. ..EEEEEEE. ...EEEEEEE ....EEEEE. .....EEE.. ......E... 16 50 .................................................. .........AAAAAAAAAAAAAAAA......................... ....PPP...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA..... ....PPP...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA..... ....PPP...AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.... ....PPP..............AAAAA.AAAAAAAAAAAAAAAA....... ....PPP................A....AAA.AAAAAAAAAA........ ....PPP...........IIIIIAAIIAIII.AAAAAAAAAA........ ..CCCCCCCCCCCCC...IIIIIIAAAAAAAAAAAAAAAAAA........ ..CCCCCCCCCCCCC...IIIIIIIIIIIII...AAAAAAAAAA...... ....PPP............................AAAAAAAAAA..... MMMMPPPMMMMMMMMMMMMMMM.............AAAAAAAAAAA.... MMMMPPPMMMMMMMMMMMMMMM..............AAAAAAAAAAA... MMMMMMMMMMMMMMMMMMMMMM...............AAAAAAAAAA... MMMMMMMMMMMMMMMMMMMMMM...............AAAAAAAAAA... MMMMMMMMMMMMMMMMMMMMMM............................
SAFE SAFE SAFE SUSPICIOUS SUSPICIOUS SUSPICIOUS