Submission #165088

# Submission time Handle Problem Language Result Execution time Memory
165088 2019-11-25T06:30:45 Z Atill83 Mobitel (COCI14_mobitel) C++14
0 / 50
2 ms 376 KB
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n;
int dis[15];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);

    #ifdef Local
        freopen("../IO/int.txt","r",stdin);
        freopen("../IO/out.txt","w",stdout);
    #endif

    for(int i = 1; i <= 9; i++){
        int a;
        cin>>a;
        dis[a] = i;
    }
    string s;
    cin>>s;

    s = '.' + s;
    for(int i = 1; i < s.length(); i++){
        if((s[i] - 'a')/3 == (s[i - 1] - 'a')/3){
            cout<<"#";
        }
        int kac = ((int)s[i] - 'a');
        int yer, many;
        if(kac >= 15 && kac <= 18){
            yer = 7;
            many = kac - 14;
        }else if(kac >= 22 && kac <= 25){
            yer = 9;
            many = kac - 21;
        }else if(kac > 18 && kac < 22){
            yer = 8;
            many = kac - 18;
        }else{
            yer = kac/3 + 2;
            many = kac % 3 + 1;
        }

        for(int j = 0; j < many; j++){
            cout<<dis[yer];
        }
    }

    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}

Compilation message

mobitel.cpp: In function 'int main()':
mobitel.cpp:34:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 1; i < s.length(); i++){
                    ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Halted 0 ms 0 KB -