답안 #559624

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
559624 2022-05-10T10:00:45 Z Trunkty ZigZag (COCI17_zigzag) C++14
80 / 80
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

zigzag.cpp: In function 'int main()':
zigzag.cpp:25:11: warning: array subscript has type 'char' [-Wchar-subscripts]
   25 |   arr[s[0]].push_back(s);
      |           ^
zigzag.cpp:33:22: warning: array subscript has type 'char' [-Wchar-subscripts]
   33 |   string a = arr[s[0]].front();
      |                      ^
zigzag.cpp:34:11: warning: array subscript has type 'char' [-Wchar-subscripts]
   34 |   arr[s[0]].pop_front();
      |           ^
zigzag.cpp:35:11: warning: array subscript has type 'char' [-Wchar-subscripts]
   35 |   arr[s[0]].push_back(a);
      |           ^
# 결과 실행 시간 메모리 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