Submission #94167

#TimeUsernameProblemLanguageResultExecution timeMemory
94167YigitTavan (COCI16_tavan)C++14
48 / 80
1082 ms376 KiB
#include<bits/stdc++.h> using namespace std; long long int power(int a,int b){ int sonuc=1; while(b>0){ if(b%2==1){ sonuc*=a; b--; } else{ a=a*a; b=b/2; } } return sonuc; } int main(){ long long int n,hata,uzun,inci,i,m,us; char tab[505][26]; char ana[100000]; scanf("%lld",&n); scanf("%lld",&hata); scanf("%lld",&uzun); scanf("%lld",&inci); for(i=0;i<n;i++)scanf(" %c",&ana[i]); for(i=0;i<hata;i++){ for(m=0;m<uzun;m++){ scanf(" %c",&tab[i][m]); } sort(tab[i],tab[i]+uzun); } us=power(uzun,hata-1); int coz[10000],k=0,sira=0; while(inci>0){ //printf("%d %d\n",us,inci); if(us==inci && inci==1){ coz[sira]=k; inci--; } if(us>=inci){ us/=uzun; coz[sira]=k; k=0; sira++; } else{ inci-=us; k++; } } int l=0; for(i=0;i<n;i++){ if(ana[i]!='#')printf("%c",ana[i]); else{ printf("%c",tab[l][coz[l]]); l++; } } }

Compilation message (stderr)

tavan.cpp: In function 'int main()':
tavan.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
tavan.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&hata);
  ~~~~~^~~~~~~~~~~~~~
tavan.cpp:27:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&uzun);
  ~~~~~^~~~~~~~~~~~~~
tavan.cpp:28:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&inci);
  ~~~~~^~~~~~~~~~~~~~
tavan.cpp:29:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=0;i<n;i++)scanf(" %c",&ana[i]);
                  ~~~~~^~~~~~~~~~~~~~~
tavan.cpp:32:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(" %c",&tab[i][m]);
    ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...