# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
559624 | 2022-05-10T10:00:45 Z | Trunkty | ZigZag (COCI17_zigzag) | C++14 | 65 ms | 7988 KB |
#include <iostream> #include <vector> #include <algorithm> #include <queue> using namespace std; typedef long long ll; #define DEBUG #ifdef DEBUG #define debug(x) cout << #x << ": " << x << endl #else #define debug(x) #endif int k,n; deque<string> arr[205]; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> k >> n; for(int i=1;i<=k;i++){ string s; cin >> s; arr[s[0]].push_back(s); } for(int i=1;i<=200;i++){ sort(arr[i].begin(),arr[i].end()); } for(int i=1;i<=n;i++){ string s; cin >> s; string a = arr[s[0]].front(); arr[s[0]].pop_front(); arr[s[0]].push_back(a); cout << a << "\n"; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 468 KB | Output is correct |
2 | Correct | 1 ms | 468 KB | Output is correct |
3 | Correct | 1 ms | 464 KB | Output is correct |
4 | Correct | 1 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 1 ms | 468 KB | Output is correct |
7 | Correct | 59 ms | 7984 KB | Output is correct |
8 | Correct | 61 ms | 7988 KB | Output is correct |
9 | Correct | 61 ms | 7944 KB | Output is correct |
10 | Correct | 65 ms | 7988 KB | Output is correct |