# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
397599 | victoriad | 고장난 휴대전화기 (COCI14_mobitel) | C++14 | 1 ms | 224 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
vector<int>g(9);
int a;
for(int i=0;i<9;i++){
cin>>a;
g[a-1]=i+1;
}
int ant=-1;
string s;
cin>>s;
for(int i=0;i<s.length();i++){
if(s[i]=='a'){
if(ant==g[1]){
cout<<'#'<<g[1];
}
else{
cout<<g[1];
}
ant=g[1];
}
else if(s[i]=='b'){
if(ant==g[1]){
cout<<'#'<<g[1]<<g[1];
}
else{
cout<<g[1]<<g[1];
}
ant=g[1];
}
else if(s[i]=='c'){
if(ant==g[1]){
cout<<'#'<<g[1]<<g[1]<<g[1];
}
else{
cout<<g[1]<<g[1]<<g[1];
}
ant=g[1];
}
else if(s[i]=='d'){
if(ant==g[2]){
cout<<'#'<<g[2];
}
else{
cout<<g[2];
}
ant=g[2];
}
else if(s[i]=='e'){
if(ant==g[2]){
cout<<'#'<<g[2]<<g[2];
}
else{
cout<<g[2]<<g[2];
}
ant=g[2];
}
else if(s[i]=='f'){
if(ant==g[2]){
cout<<'#'<<g[2]<<g[2]<<g[2];
}
else{
cout<<g[2]<<g[2]<<g[2];
}
ant=g[2];
}
else if(s[i]=='g'){
if(ant==g[3]){
cout<<'#'<<g[3];
}
else{
cout<<g[3];
}
ant=g[3];
}
else if(s[i]=='h'){
if(ant==g[3]){
cout<<'#'<<g[3]<<g[3];
}
else{
cout<<g[3]<<g[3];
}
ant=g[3];
}
else if(s[i]=='i'){
if(ant==g[3]){
cout<<'#'<<g[3]<<g[3]<<g[3];
}
else{
cout<<g[3]<<g[3]<<g[3];
}
ant=g[3];
}
else if(s[i]=='j'){
if(ant==g[4]){
cout<<'#'<<g[4];
}
else{
cout<<g[4];
}
ant=g[4];
}
else if(s[i]=='k'){
if(ant==g[4]){
cout<<'#'<<g[4]<<g[4];
}
else{
cout<<g[4]<<g[4];
}
ant=g[4];
}
else if(s[i]=='l'){
if(ant==g[4]){
cout<<'#'<<g[4]<<g[4]<<g[4];
}
else{
cout<<g[4]<<g[4]<<g[4];
}
ant=g[4];
}
else if(s[i]=='m'){
if(ant==g[5]){
cout<<'#'<<g[5];
}
else{
cout<<g[5];
}
ant=g[5];
}
else if(s[i]=='n'){
if(ant==g[5]){
cout<<'#'<<g[5]<<g[5];
}
else{
cout<<g[5]<<g[5];
}
ant=g[5];
}
else if(s[i]=='o'){
if(ant==g[5]){
cout<<'#'<<g[5]<<g[5]<<g[5];
}
else{
cout<<g[5]<<g[5]<<g[5];
}
ant=g[5];
}
else if(s[i]=='p'){
if(ant==g[6]){
cout<<'#'<<g[6];
}
else{
cout<<g[6];
}
ant=g[6];
}
else if(s[i]=='q'){
if(ant==g[6]){
cout<<'#'<<g[6]<<g[6];
}
else{
cout<<g[6]<<g[6];
}
ant=g[6];
}
else if(s[i]=='r'){
if(ant==g[6]){
cout<<'#'<<g[6]<<g[6]<<g[6];
}
else{
cout<<g[6]<<g[6]<<g[6];
}
ant=g[6];
}
else if(s[i]=='s'){
if(ant==g[6]){
cout<<'#'<<g[6]<<g[6]<<g[6]<<g[6];
}
else{
cout<<g[6]<<g[6]<<g[6]<<g[6];
}
ant=g[6];
}
else if(s[i]=='t'){
if(ant==g[7]){
cout<<'#'<<g[7];
}
else{
cout<<g[7];
}
ant=g[7];
}
else if(s[i]=='u'){
if(ant==g[7]){
cout<<'#'<<g[7]<<g[7];
}
else{
cout<<g[7]<<g[7];
}
ant=g[7];
}
else if(s[i]=='v'){
if(ant==g[7]){
cout<<'#'<<g[7]<<g[7]<<g[7];
}
else{
cout<<g[7]<<g[7]<<g[7];
}
ant=g[7];
}
else if(s[i]=='w'){
if(ant==g[8]){
cout<<'#'<<g[8];
}
else{
cout<<g[8];
}
ant=g[8];
}
else if(s[i]=='x'){
if(ant==g[8]){
cout<<'#'<<g[8]<<g[8];
}
else{
cout<<g[8]<<g[8];
}
ant=g[8];
}
else if(s[i]=='y'){
if(ant==g[8]){
cout<<'#'<<g[8]<<g[8]<<g[8];
}
else{
cout<<g[8]<<g[8]<<g[8];
}
ant=g[8];
}
else if(s[i]=='z'){
if(ant==g[8]){
cout<<'#'<<g[8]<<g[8]<<g[8]<<g[8];
}
else{
cout<<g[8]<<g[8]<<g[8]<<g[8];
}
ant=g[8];
}
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |