Submission #156419

#TimeUsernameProblemLanguageResultExecution timeMemory
156419mdn2002Tavan (COCI16_tavan)C++14
48 / 80
6 ms384 KiB
#include<bits/stdc++.h> using namespace std; long long mod=1e9+7; int n,m,k,x; string s; vector<string>v; vector<char>c; int main() { cin>>n>>m>>k>>x; cin>>s; for(int i=0;i<m;i++) { string x; cin>>x; sort(x.begin(),x.end()); v.push_back(x); } for(int i=0;i<m;i++) { long long mx=0,lmx=0; for(int j=0;j<k;j++) { mx+=pow(k,m-i-1); if(mx>=x) { c.push_back(v[i][j]); x-=lmx+1; break; } lmx=mx; } } int kk=0; for(int i=0;i<s.size();i++) { if(s[i]=='#')cout<<c[kk++]; else cout<<s[i]; } }

Compilation message (stderr)

tavan.cpp: In function 'int main()':
tavan.cpp:35:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<s.size();i++)
                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...