Submission #383031

# Submission time Handle Problem Language Result Execution time Memory
383031 2021-03-28T17:54:19 Z vulpes Mobitel (COCI14_mobitel) C++17
50 / 50
2 ms 364 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    vector<int> a(10);
    for (int i = 1; i < 10; i++) {
        int x; cin >> x; a[x] = i;
    }
    string s; cin >> s;
    int p = 0, n = s.size();
    vector<char> c = {'a', 'd', 'g', 'j', 'm', 'p', 't', 'w'};
    for (int i = 0; i < n; i++) {
        for (int j = 7; j >= 0; j--) {
            if (s[i] >= c[j]) {
                if (p == j + 2) {
                    cout << "#";
                }
                for (int k = 0; k <= s[i] - c[j]; k++) {
                    cout << a[j + 2];
                }
                p = j + 2;
                break;
            }
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 2 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct