Submission #210780

#TimeUsernameProblemLanguageResultExecution timeMemory
210780tleontest1Mobitel (COCI14_mobitel)C++14
50 / 50
6 ms504 KiB
#pragma GCC optimize ("O3") #pragma GCC target ("sse4") #include <bits/stdc++.h> using namespace std; typedef long long int lo; typedef pair< int,int > PII; #define fi first #define se second #define mp make_pair #define pb push_back #define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define FOR for(lo i=1;i<=9;i++) #define mid (bas+son)/2 const lo MAX = -1000000000000000000; const lo MIN = 1000000000000000000; const lo inf = 1000000000; const lo KOK = 100000; const lo LOG = 30; const lo li = 100005; const lo mod = 1000000007; lo n,m,cev,b[li],a[li],k; string s; map<int,int> mpp; vector<int> v; int main(){ //~ scanf("%lld",&n); FOR{ scanf("%lld",&a[i]); mpp[a[i]]=i; } cin>>s; for(int i=0;i<(int)s.size();i++){ if(s[i]=='a'){ if(s[i-1]=='a' || s[i-1]=='b' || s[i-1]=='c') cout<<"#"; cout<<mpp[2]; } if(s[i]=='b'){ if(s[i-1]=='a' || s[i-1]=='b' || s[i-1]=='c') cout<<"#"; cout<<mpp[2]<<mpp[2]; } if(s[i]=='c'){ if(s[i-1]=='a' || s[i-1]=='b' || s[i-1]=='c') cout<<"#"; cout<<mpp[2]<<mpp[2]<<mpp[2]; } if(s[i]=='d'){ if(s[i-1]=='d' || s[i-1]=='e' || s[i-1]=='f') cout<<"#"; cout<<mpp[3]; } if(s[i]=='e'){ if(s[i-1]=='d' || s[i-1]=='e' || s[i-1]=='f') cout<<"#"; cout<<mpp[3]<<mpp[3]; } if(s[i]=='f'){ if(s[i-1]=='d' || s[i-1]=='e' || s[i-1]=='f') cout<<"#"; cout<<mpp[3]<<mpp[3]<<mpp[3]; } if(s[i]=='g'){ if(s[i-1]=='g' || s[i-1]=='h' || s[i-1]=='i') cout<<"#"; cout<<mpp[4]; } if(s[i]=='h'){ if(s[i-1]=='g' || s[i-1]=='h' || s[i-1]=='i') cout<<"#"; cout<<mpp[4]<<mpp[4]; } if(s[i]=='i'){ if(s[i-1]=='g' || s[i-1]=='h' || s[i-1]=='i') cout<<"#"; cout<<mpp[4]<<mpp[4]<<mpp[4]; } if(s[i]=='j'){ if(s[i-1]=='j' || s[i-1]=='k' || s[i-1]=='l') cout<<"#"; cout<<mpp[5]; } if(s[i]=='k'){ if(s[i-1]=='j' || s[i-1]=='k' || s[i-1]=='l') cout<<"#"; cout<<mpp[5]<<mpp[5]; } if(s[i]=='l'){ if(s[i-1]=='j' || s[i-1]=='k' || s[i-1]=='l') cout<<"#"; cout<<mpp[5]<<mpp[5]<<mpp[5]; } if(s[i]=='m'){ if(s[i-1]=='m' || s[i-1]=='n' || s[i-1]=='o') cout<<"#"; cout<<mpp[6]; } if(s[i]=='n'){ if(s[i-1]=='m' || s[i-1]=='n' || s[i-1]=='o') cout<<"#"; cout<<mpp[6]<<mpp[6]; } if(s[i]=='o'){ if(s[i-1]=='m' || s[i-1]=='n' || s[i-1]=='o') cout<<"#"; cout<<mpp[6]<<mpp[6]<<mpp[6]; } if(s[i]=='p'){ if(s[i-1]=='p' || s[i-1]=='q' || s[i-1]=='r' || s[i-1]=='s') cout<<"#"; cout<<mpp[7]; } if(s[i]=='q'){ if(s[i-1]=='p' || s[i-1]=='q' || s[i-1]=='r' || s[i-1]=='s') cout<<"#"; cout<<mpp[7]<<mpp[7]; } if(s[i]=='r'){ if(s[i-1]=='p' || s[i-1]=='q' || s[i-1]=='r' || s[i-1]=='s') cout<<"#"; cout<<mpp[7]<<mpp[7]<<mpp[7]; } if(s[i]=='s'){ if(s[i-1]=='p' || s[i-1]=='q' || s[i-1]=='r' || s[i-1]=='s') cout<<"#"; cout<<mpp[7]<<mpp[7]<<mpp[7]<<mpp[7]; } if(s[i]=='t'){ if(s[i-1]=='t' || s[i-1]=='u' || s[i-1]=='v') cout<<"#"; cout<<mpp[8]; } if(s[i]=='u'){ if(s[i-1]=='t' || s[i-1]=='u' || s[i-1]=='v') cout<<"#"; cout<<mpp[8]<<mpp[8]; } if(s[i]=='v'){ if(s[i-1]=='t' || s[i-1]=='u' || s[i-1]=='v') cout<<"#"; cout<<mpp[8]<<mpp[8]<<mpp[8]; } if(s[i]=='w'){ if(s[i-1]=='w' || s[i-1]=='x' || s[i-1]=='y' || s[i-1]=='z') cout<<"#"; cout<<mpp[9]; } if(s[i]=='x'){ if(s[i-1]=='w' || s[i-1]=='x' || s[i-1]=='y' || s[i-1]=='z') cout<<"#"; cout<<mpp[9]<<mpp[9]; } if(s[i]=='y'){ if(s[i-1]=='w' || s[i-1]=='x' || s[i-1]=='y' || s[i-1]=='z') cout<<"#"; cout<<mpp[9]<<mpp[9]<<mpp[9]; } if(s[i]=='z'){ if(s[i-1]=='w' || s[i-1]=='x' || s[i-1]=='y' || s[i-1]=='z') cout<<"#"; cout<<mpp[9]<<mpp[9]<<mpp[9]<<mpp[9]; } } return 0; }

Compilation message (stderr)

mobitel.cpp: In function 'int main()':
mobitel.cpp:35:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&a[i]);
   ~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...