Submission #92927

# Submission time Handle Problem Language Result Execution time Memory
92927 2019-01-06T00:39:07 Z AntonioDaki Mobitel (COCI14_mobitel) C++14
0 / 50
2 ms 504 KB
#include<bits/stdc++.h>

using namespace std;

#define br (s[i]-94)%3
#define t (s[i]-91)/3

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
    int k[12], p = 0;
    string s;
    k[0] = 0;
    for(int i = 1; i <= 9; ++i) cin >> k[i];
    cin >> s;
    for(int i = 0; i < s.size(); ++i){
    	if(s[i] < 112){
		    for(int j = 1; j <= 9; ++j)
			    if(k[j] == t){
			    	if(j == p) cout << "#";
			    	p = j;
				    if(br == 0) cout << j;
				    else if(br == 1) cout << j << j;
				    else cout << j << j << j;
				}
			}
    	else if(s[i] < 116){
    	    for(int j = 1; j <= 9; ++j)
			    if(k[j] == 7){
			    	if(j == p) cout << "#";
			    	p = j;
				    if(s[i] == 112) cout << j;
				    else if(s[i] == 113) cout << j << j;
				    else if(s[i] == 114) cout << j << j << j;
				    else cout << j << j << j << j;
				}
			}
		else if(s[i] < 119){
    	    for(int j = 1; j <= 9; ++j)
			    if(k[j] == 8){
			    	if(j == p) cout << "#";
			    	p = j;
				    if(s[i] == 116) cout << j;
				    else if(s[i] == 117) cout << j << j;
				    else cout << j << j << j;
				}
			}
		else{
		    for(int j = 1; j <= 9; ++j)
			    if(k[j] == 7){
				    if(j == p) cout << "#";
			        p = j;
			        if(s[i] == 119) cout << j;
			        else if(s[i] == 120) cout << j << j;
			        else if(s[i] == 121) cout << j << j << j;
			        else cout << j << j << j << j;
			}
		}
	}

	return 0;
}

Compilation message

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