이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "paint.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define repa(i,a,b) for(int i = (a); i >= (b); i--)
#define lli long long int
#define debug(a) cout << #a << " = " << a<< endl
#define nl "\n";
lli cont,mayor,sobrantes,n,a;
lli arr[1002];
string res;
std::string solve_puzzle(std::string s, std::vector<int> c) {
cont = 0;
for(auto act : c){
if (cont > 0) arr[cont++] = 0;
rep(i,1,act) arr[cont++] = i;
}
n = s.size();
sobrantes = n-cont;
res.resize(n);
if (sobrantes == 0){
rep(i,0,n-1) {
if (arr[i] == 0) res[i] = '_';
else res[i] = 'X';
}
return res;
}
mayor = 0;
repa(i,n-1,0) {
if(arr[i] > mayor) {
mayor = arr[i];
if (mayor < sobrantes){
a = sobrantes - mayor;
rep(j,1,a) {
res[i+j] = '?';
res[i+j+mayor] = '?';
}
}
}
else if (arr[i] == 0) {
mayor = 0;
continue;
}
if (arr[i] <= sobrantes) {
res[i] = '?';
res[i+mayor] = '?';
}
}
rep(i,0,n-1) if (res[i] != '?') res[i] = 'X';
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |