답안 #82063

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
82063 2018-10-28T21:18:01 Z heon Tavan (COCI16_tavan) C++11
48 / 80
4 ms 768 KB
#include<bits/stdc++.h>

using namespace std;

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m,k,x;
	cin >> n >> m >> k >> x;
	string s;
	cin >> s;
	vector <string> v(m);
	for(int i = 0; i < m; i++){
		cin >> v[i];
		sort(v[i].begin(), v[i].end());
	}
	long long curr = 0;
	int ind = 0;
	vector <char> rj;
	for(int i = 0; i < m; i++){
		while(curr < x){
			curr += max(1 ,(m - i - 1) * k);
			if(curr >= x){
				rj.push_back(v[i][ind]);
				ind = 0;
			}
			else ind++; 
		}
		curr -= (m - i - 1) * k;
	}

	for(auto x : s) (x == '#') ? cout << rj[ind++] : cout << x;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 532 KB Output is correct
4 Correct 2 ms 532 KB Output is correct
5 Correct 2 ms 532 KB Output is correct
6 Correct 2 ms 532 KB Output is correct
7 Runtime error 4 ms 580 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 3 ms 688 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Incorrect 2 ms 688 KB Output isn't correct
10 Runtime error 3 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)