# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
103495 | 2019-03-30T20:11:34 Z | leonarda | Mobitel (COCI14_mobitel) | C++14 | 3 ms | 512 KB |
#include<bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define first ff #define second ss typedef pair<int, int> pi; typedef long long int lint; const int inf = 0x3f3f3f3f; int a[10]; string s; int slova[30], novo[30], poredu[30]; int main () { ios::sync_with_stdio(0); for(int i = 0; i < 9; ++i) cin >> a[i]; cin >> s; slova[0] = slova[1] = slova[2] = 2; slova[3] = slova[4] = slova[5] = 3; slova[6] = slova[7] = slova[8] = 4; slova[9] = slova[10] = slova[11] = 5; slova[12] = slova[13] = slova[14] = 6; slova[15] = slova[16] = slova[17] = slova[18] = 7; slova[19] = slova[20] = slova[21] = 8; slova[22] = slova[23] = slova[24] = slova[25] = 9; poredu[0] = poredu[3] = poredu[6] = poredu[9] = poredu[12] = poredu[15] = poredu[19] = poredu[22] = 1; poredu[1] = poredu[4] = poredu[7] = poredu[10] = poredu[13] = poredu[16] = poredu[20] = poredu[23] = 2; poredu[2] = poredu[5] = poredu[8] = poredu[11] = poredu[14] = poredu[17] = poredu[21] = poredu[24] = 3; poredu[18] = poredu[25] = 4; //tko se ponaša kao tipka 5? for(int i = 0; i < 9; ++i) { for(int j = 0; j < 26; ++j) if(slova[j] == a[i]) novo[j] = i + 1; } int ex = -1; for(int i = 0; i < s.size(); ++i) { int cur = novo[s[i] - 'a']; if(cur == ex) cout << "#"; ex = cur; for(int j = 0; j < poredu[s[i] - 'a']; ++j) cout << cur; } // for(int i = 0; i < 26; ++i) // cout << (char)(i + 'a') << " " << novo[i] << " "; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 512 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 3 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 3 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |