This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "paint.h"
#include <bits/stdc++.h>
using namespace std;
bool IsInRange(pair <int,int> m, int x) {
return m.first <= x && m.second >= x;
}
string solve_puzzle(string s, vector<int> c) {
pair <int,int> beg = make_pair (1, c[0]);
//cout << "[1, " << c[0] << "]\n";
pair <int,int> end = make_pair (s.size()-c[0]+1, s.size());
//cout << "[" << s.size()-c[0] << ", " << s.size() << "]\n";
pair <int,int> mixed = make_pair (end.first, beg.second);
//cout << "[" << mixed.first << ", " << mixed.second << "]\n";
string res = "";
for (int i=1; i<=s.size(); i++) {
if (IsInRange(mixed, i)) res += "X";
else res += "?";
}
return res;
}
Compilation message (stderr)
paint.cpp: In function 'std::__cxx11::string solve_puzzle(std::__cxx11::string, std::vector<int>)':
paint.cpp:19:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=1; i<=s.size(); i++) {
~^~~~~~~~~~
# | 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... |