제출 #559624

#제출 시각아이디문제언어결과실행 시간메모리
559624TrunktyZigZag (COCI17_zigzag)C++14
80 / 80
65 ms7988 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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);
      |           ^
#Verdict Execution timeMemoryGrader output
Fetching results...