답안 #650189

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
650189 2022-10-12T16:41:56 Z TeKe 고장난 휴대전화기 (COCI14_mobitel) C++17
50 / 50
1 ms 324 KB
/*#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
#include<bits/stdc++.h>
/**/
//typedef int ll;
typedef long long ll;
typedef unsigned long long ull;
/*typedef __int128 vll;
typedef unsigned __int128 uvll;*/
#define llll std::pair<ll , ll>
#define pb push_back
#define pf push_front
#define halo cout << "hello\n"
#define fi first
#define sec second
#define all(a) a.begin() , a.end()
const ll limit = 1e15+7; 
const ll ous = 2e5 + 7;
const ll dx[4] = {-1 , 0 , 1 , 0} , dy[4] = {0,1,0,-1};
std::vector<ll> ar;
ll n;
void solve(){
    ar.resize(10);
    for(ll i = 1;10>i;i++){
        ll x;std::cin >> x;
        ar[x] = i;
    }
    std::string h;std::cin >> h;
    ll j = 0 , s = 2;
    llll alph[26];
    for(ll i = 'a';'z' >= i;i++){
        if(j == 3 && s != 7 && s!= 9){
            j = 0;
            s++;
        }
        if(j == 4){
            j = 0;
            s++;
        }
        j++;
        alph[i - 'a'] = {j , s};
    }
    for(ll i = 0;h.size() > i;i++){
        if(i != 0 && alph[h[i-1] - 'a'].sec == alph[h[i] - 'a'].sec){
            std::cout << "#";
        }
        for(ll k = 0;alph[h[i] - 'a'].fi > k;k++){
            std::cout << ar[alph[h[i] - 'a'].sec];
        }
    }
    std::cout << "\n";
    return; /**/
}
signed main(){
    std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);
    ll t=1;
    //std::cin >> t;
    ll o = 1;
    while(t--){ 
        //cout << "Case " << o++ << ":\n";
        solve();
    }
    return 0; 
}

Compilation message

mobitel.cpp:5:78: warning: "/*" within comment [-Wcomment]
    5 | #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
      |                                                                               
mobitel.cpp: In function 'void solve()':
mobitel.cpp:46:27: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   46 |     for(ll i = 0;h.size() > i;i++){
      |                  ~~~~~~~~~^~~
mobitel.cpp: In function 'int main()':
mobitel.cpp:61:8: warning: unused variable 'o' [-Wunused-variable]
   61 |     ll o = 1;
      |        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 324 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 320 KB Output is correct
10 Correct 0 ms 324 KB Output is correct