Submission #85890

#TimeUsernameProblemLanguageResultExecution timeMemory
85890memetkagan44Mobitel (COCI14_mobitel)C++11
50 / 50
3 ms640 KiB
#include<bits/stdc++.h> using namespace std; int a,gst[15]; char ar[105]; map<char,pair<int,int> > val; int main(){ for(int i=1;i<=9;i++){ scanf("%d",&a); gst[a]=i; } scanf("%s",ar+1); char c='a'; for(int i=2; c<='r' ;i++) for(int j=1;j<=3;j++,c++) val[c]=make_pair(gst[i],j); val[c++]=make_pair(gst[7],4); for(int i=8; c<='y';i++) for(int j=1;j<=3;j++,c++) val[c]=make_pair(gst[i],j); val[c]=make_pair(gst[9],4); for(int i=1,k=-1;i<=strlen(ar+1);i++){ if(k==val[ar[i]].first) printf("#"); k=val[ar[i]].first; for(int j=1;j<=val[ar[i]].second;j++) printf("%d",k); } printf("\n"); return 0; }

Compilation message (stderr)

mobitel.cpp: In function 'int main()':
mobitel.cpp:21:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=1,k=-1;i<=strlen(ar+1);i++){
                      ~^~~~~~~~~~~~~~
mobitel.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&a);
         ~~~~~^~~~~~~~~
mobitel.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s",ar+1);
     ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...