# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166645 | 2019-12-03T11:08:10 Z | ArKCa | ZigZag (COCI17_zigzag) | C++17 | 474 ms | 10824 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 4 ms | 376 KB | Output is correct |
5 | Correct | 19 ms | 376 KB | Output is correct |
6 | Correct | 4 ms | 504 KB | Output is correct |
7 | Correct | 468 ms | 10704 KB | Output is correct |
8 | Correct | 463 ms | 10588 KB | Output is correct |
9 | Correct | 467 ms | 10716 KB | Output is correct |
10 | Correct | 474 ms | 10824 KB | Output is correct |