Submission #82061

# Submission time Handle Problem Language Result Execution time Memory
82061 2018-10-28T21:13:52 Z heon Tavan (COCI16_tavan) C++11
48 / 80
3 ms 1064 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());
	}
	int curr = 0, 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;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 628 KB Output is correct
3 Correct 2 ms 628 KB Output is correct
4 Correct 2 ms 716 KB Output is correct
5 Correct 2 ms 836 KB Output is correct
6 Correct 2 ms 848 KB Output is correct
7 Runtime error 3 ms 944 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 2 ms 1064 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Incorrect 2 ms 1064 KB Output isn't correct
10 Runtime error 3 ms 1064 KB Execution killed with signal 11 (could be triggered by violating memory limits)