# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166645 | ArKCa | ZigZag (COCI17_zigzag) | C++17 | 474 ms | 10824 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define pob pop_back
#define N 10
using namespace std;
vector<string>v;
vector<string>vv[50];
int k,n;
char sa;
string s1;
int dizi[50];
int main(){
// freopen("a.gir","r",stdin);
// freopen("a.cik","w",stdout);
cin>>k>>n;
for(int i=0;i<k;i++){
cin>>s1;
v.pb(s1);
// cout<<s1<<endl;
}
sort(v.begin(), v.end());
for(int i=0;i<k;i++){
vv[v[i][0]%32].pb(v[i]);
}
for(int i=0;i<n;i++){
cin>>sa;
cout<<vv[sa%32][dizi[sa%32]]<<endl;
dizi[sa%32]++;
if(dizi[sa%32]==vv[sa%32].size())dizi[sa%32]=0;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |