Submission #858335

#TimeUsernameProblemLanguageResultExecution timeMemory
858335ily2003고장난 휴대전화기 (COCI14_mobitel)C++14
50 / 50
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; #define f first #define s second int x,dp[10]; string s; map<char,pair<int,int>> check; int main() { check['a']={2,1};check['b']={2,2};check['c']={2,3}; check['d']={3,1};check['e']={3,2};check['f']={3,3}; check['g']={4,1};check['h']={4,2};check['i']={4,3}; check['j']={5,1};check['k']={5,2};check['l']={5,3}; check['m']={6,1};check['n']={6,2};check['o']={6,3}; check['p']={7,1};check['q']={7,2};check['r']={7,3};check['s']={7,4}; check['t']={8,1};check['u']={8,2};check['v']={8,3}; check['w']={9,1};check['x']={9,2};check['y']={9,3};check['z']={9,4}; for (int i=1;i<=9;++i) cin >> x,dp[x]=i; cin >> s; auto the=check[s[0]]; for (int i=1;i<=the.s;++i) cout << dp[the.f]; for (int i=1;i<s.size();++i) { auto the1=check[s[i]]; if (the.f==the1.f) cout << "#"; for (int i=1;i<=the1.s;++i) cout << dp[the1.f]; the=the1; } }

Compilation message (stderr)

mobitel.cpp: In function 'int main()':
mobitel.cpp:21:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for (int i=1;i<s.size();++i) {
      |                  ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...