QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#289777 | #7857. (-1,1)-Sumplete | ucup-team139# | TL | 1224ms | 406188kb | C++17 | 23.8kb | 2023-12-23 23:50:18 | 2023-12-23 23:50:19 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
template <class T> struct is_iterator {
template <class U, typename enable_if<!is_convertible<U, const char*>::value, int>::type = 0>
constexpr static auto has_indirection(int) -> decltype(*declval<U>(), bool()) { return true; }
template <class> constexpr static bool has_indirection(long) { return false; }
constexpr static bool value = has_indirection<T>(0);
};
using uint = unsigned int;
// Buffer size should be 2^12 or 2^13 for optimal performance with files.
const uint BUFFER_SIZE = 1 << 12;
// Maximum possible length of a string representing primitive type
// assuming we won't encounter huge double values.
const uint MAX_LENGTH = 1 << 7;
namespace Detail {
struct Width { uint value; };
struct Fill { char value; };
struct Base { uint value; };
struct Precision { uint value; };
struct Delimiter { const char* value; };
} // namespace Detail
Detail::Width setWidth(uint value = 0) { return {value}; }
Detail::Fill setFill(char value = ' ') { return {value}; }
Detail::Base setBase(uint value = 10) { assert(2 <= value && value <= 36); return {value}; }
Detail::Precision setPrecision(uint value = 9) { assert(value < MAX_LENGTH); return {value}; }
Detail::Delimiter setDelimiter(const char* value = " ") { return {value}; }
/******************************* input classes ********************************/
class InputDevice {
protected:
const char* head;
const char* tail;
InputDevice(const char* head, const char* tail) : head(head), tail(tail), base(setBase().value) {}
virtual void fillInput() = 0;
inline char nextChar() {
if (__builtin_expect(head >= tail, false)) fillInput();
return *head++;
}
template <class I> int readUnsignedIntGeneral(I& arg, char c) {
I value = 0;
int length = 0;
for (;; ++length, c = nextChar()) {
if (isDigit(c)) c -= '0';
else if (isUpper(c)) c -= 'A' - 10;
else if (isLower(c)) c -= 'a' - 10;
else c = base;
if (c >= base) break;
value = base * value + c;
}
arg = value;
return --head, length;
}
template <class I> inline int readUnsignedInt(I& arg, char c) {
if (__builtin_expect(base > 10, false)) return readUnsignedIntGeneral(arg, c);
I value = 0;
int length = 0;
for (; static_cast<unsigned char>(c - '0') < base; ++length, c = nextChar())
value = base * value + c - '0';
arg = value;
return --head, length;
}
template <class I> inline bool readSignedInt(I& arg, char c) {
bool negative = c == '-';
if (negative) c = nextChar();
typename make_unsigned<I>::type unsignedArg;
if (readUnsignedInt(unsignedArg, c) == 0) return false;
arg = negative ? ~static_cast<I>(unsignedArg - 1) : static_cast<I>(unsignedArg);
return true;
}
template <class F> bool readFloatingPoint(F& arg, char c) {
bool negative = c == '-';
if (negative) c = nextChar();
unsigned long long integerPart;
if (readUnsignedInt(integerPart, c) == 0) return false;
arg = static_cast<F>(integerPart);
if (nextChar() == '.') {
unsigned long long fractionalPart = 0;
int fractionalLength = readUnsignedInt(fractionalPart, nextChar());
if (fractionalLength > 0) {
unsigned long long basePower = 1;
for (; fractionalLength; --fractionalLength) basePower *= base;
arg += static_cast<F>(fractionalPart) / basePower;
}
} else --head;
if (negative) arg = -arg;
return true;
}
public:
uint base;
InputDevice(InputDevice const&) = delete;
InputDevice& operator = (InputDevice const&) = delete;
static inline bool isSpace(char c) { return static_cast<unsigned char>(c - '\t') < 5 || c == ' '; }
static inline bool isDigit(char c) { return static_cast<unsigned char>(c - '0') < 10; }
static inline bool isUpper(char c) { return static_cast<unsigned char>(c - 'A') < 26; }
static inline bool isLower(char c) { return static_cast<unsigned char>(c - 'a') < 26; }
static inline bool isOneOf(char c, const char* str) { return strchr(str, c) != nullptr; }
void putBack() { --head; } // can be called only once directly after successfully reading a character
inline bool readChar(char& arg) {
if (__builtin_expect(head >= tail, false)) {
fillInput();
if (__builtin_expect(head >= tail, false)) return arg = '\0', false;
}
return arg = *head++, true;
}
template <class UnaryPredicate>
inline char skipCharacters(UnaryPredicate isSkipped) {
char c;
do { c = nextChar(); } while (isSkipped(c));
return c;
}
inline char skipCharacters() { return skipCharacters(isSpace); }
template <class UnaryPredicate>
inline int readString(char* arg, int limit, UnaryPredicate isTerminator) {
skipCharacters(isTerminator);
// put back first non-skipped character, reserve space for null character
int charsRead = 0;
for (--head, --limit; head < tail; fillInput()) {
ptrdiff_t chunkSize = find_if(head, min(tail, head + limit - charsRead), isTerminator) - head;
arg = copy_n(head, chunkSize, arg);
head += chunkSize;
charsRead += chunkSize;
if (chunkSize == 0 || head < tail) break;
}
return *arg = '\0', charsRead;
}
inline int readString(char* arg, int limit, const char* terminators) {
if (!*terminators) return readString(arg, limit, InputDevice::isSpace);
return readString(arg, limit, [terminators](char c) { return InputDevice::isOneOf(c, terminators); });
}
// property setters
inline bool read(Detail::Base newBase) { base = newBase.value; return true; }
// primitive types
inline bool read() { return true; }
inline bool read(char& arg) { return readChar(arg); }
template <class I> inline typename enable_if<is_integral<I>::value && is_unsigned<I>::value,
bool>::type read(I& arg) { return readUnsignedInt(arg, skipCharacters()) > 0; }
template <class I> inline typename enable_if<is_integral<I>::value && is_signed<I>::value,
bool>::type read(I& arg) { return readSignedInt(arg, skipCharacters()); }
template <class F> inline typename enable_if<is_floating_point<F>::value,
bool>::type read(F& arg) { return readFloatingPoint(arg, skipCharacters()); }
// characters skip
inline bool read(const char& arg) { skipCharacters([arg](char c) { return arg != c; }); return true; }
inline bool read(const char* arg) {
if (*arg) skipCharacters([arg](char c) { return InputDevice::isOneOf(c, arg); });
else skipCharacters();
return putBack(), true;
}
inline bool read(bool (*isSkipped)(char)) { skipCharacters(isSkipped); putBack(); return true; }
// strings
template <class I, class Terminator, class... Ts> inline typename enable_if<is_integral<I>::value,
bool>::type read(char* arg, I limit, Terminator terminator, Ts&&... args) {
readString(arg, static_cast<int>(limit), terminator);
return read(forward<Ts>(args)...);
}
template <class I> inline typename enable_if<is_integral<I>::value,
bool>::type read(char* arg, I limit) { return read(arg, limit, ""); }
template <class... Ts>
inline bool read(char* first, char* last, Ts&&... args) {
return read(first, static_cast<int>(last - first), forward<Ts>(args)...);
}
template <int N, class... Ts>
inline bool read(char (&arg)[N], Ts&&... args) { return read(static_cast<char*>(arg), N, forward<Ts>(args)...); }
template <class Terminator, class... Ts>
inline bool read(string& arg, Terminator terminator, Ts&&... args) {
for (int length = 16, last = 0;; last += length, length <<= 1) {
arg.resize(last + length);
int charsRead = readString(&arg[last], length + 1, terminator);
if (charsRead < length) {
arg.resize(last + charsRead);
return read(forward<Ts>(args)...);
}
}
}
inline bool read(string& arg) { return read(arg, ""); }
// complex types and ranges
template <class T1, class T2>
inline bool read(pair<T1, T2>& arg) { return read(arg.first, arg.second); }
template <class T>
inline bool read(complex<T>& arg) {
T real, imag;
if (!read(real, imag)) return false;
arg.real(real), arg.imag(imag);
return true;
}
template <class T>
inline bool read(vector<T>& arg) {
uint n;
if (!read(n)) return false;
arg.resize(n);
return read(arg.begin(), arg.end());
}
template <class Iterator, class... Ts> inline typename enable_if<is_iterator<Iterator>::value,
bool>::type read(Iterator first, Iterator last, Ts&&... args) {
for (; first != last; ++first) if (!read(*first)) return false;
return read(forward<Ts>(args)...);
}
template <class Iterator, class I, class... Ts>
inline typename enable_if<is_iterator<Iterator>::value && is_integral<I>::value,
bool>::type read(Iterator first, I count, Ts&&... args) { return read(first, first + count, forward<Ts>(args)...); }
// generic forwarding
template <class T>
inline auto read(T& arg) -> decltype(arg.read(*this)) { return arg.read(*this); }
template <class T0, class T1, class... Ts>
inline typename enable_if<!is_iterator<T0>::value && !is_convertible<T0, char*>::value,
bool>::type read(T0&& arg0, T1&& arg1, Ts&&... args) {
return read(forward<T0>(arg0)) && read(forward<T1>(arg1), forward<Ts>(args)...);
}
};
class InputFile : public InputDevice {
FILE* file;
bool lineBuffered;
bool owner;
char buffer[BUFFER_SIZE];
void fillInput() override {
head = buffer;
*buffer = '\0';
if (__builtin_expect(!lineBuffered, true)) {
tail = head + fread(buffer, 1, BUFFER_SIZE, file);
} else {
tail = head;
if (fgets(buffer, BUFFER_SIZE, file)) while (*tail) ++tail;
}
}
public:
InputFile(FILE* file = stdin, bool lineBuffered = true, bool takeOwnership = false)
: InputDevice(buffer, buffer) , file(file), lineBuffered(lineBuffered), owner(takeOwnership) {}
InputFile(const char* fileName) : InputFile(fopen(fileName, "r"), false, true) {}
~InputFile() { if (owner) fclose(file); }
};
// Picks up data appended to the string but doesn't handle reallocation.
class InputString : public InputDevice {
void fillInput() override { while (*tail) ++tail; }
public:
InputString(const string& s) : InputDevice(s.data(), s.data() + s.size()) {}
InputString(const char* s) : InputDevice(s, s + strlen(s)) {}
};
/******************************* output classes *******************************/
class OutputDevice {
protected:
char buffer[BUFFER_SIZE + MAX_LENGTH];
char* output;
char* end;
bool separate;
OutputDevice() : output(buffer), end(buffer + BUFFER_SIZE + MAX_LENGTH), separate(false)
, width(setWidth().value), fill(setFill().value), base(setBase().value), precision(setPrecision().value)
, delimiter(setDelimiter().value) { computeBasePower(); }
virtual void writeToDevice(uint count) = 0;
inline void flushMaybe() {
if (__builtin_expect(output >= buffer + BUFFER_SIZE, false)) {
writeToDevice(BUFFER_SIZE);
output = copy(buffer + BUFFER_SIZE, output, buffer);
}
}
void computeBasePower() {
basePower = 1;
for (uint i = 0; i < precision; ++i) basePower *= base;
}
template <class I> inline char* writeUnsignedInt(I arg, char* last) {
if (__builtin_expect(arg == 0, false)) *--last = '0';
if (__builtin_expect(base == 10, true)) {
for (; arg; arg /= 10) *--last = '0' + arg % 10;
} else for (; arg; arg /= base) {
I digit = arg % base;
*--last = digit < 10 ? '0' + digit : 'A' - 10 + digit;
}
return last;
}
template <class I> inline char* writeSignedInt(I arg, char* last) {
auto unsignedArg = static_cast<typename make_unsigned<I>::type>(arg);
if (arg < 0) {
last = writeUnsignedInt(~unsignedArg + 1, last);
*--last = '-';
return last;
}
return writeUnsignedInt(unsignedArg, last);
}
template <class F> char* writeFloatingPoint(F arg, char* last) {
bool negative = signbit(arg);
if (negative) arg = -arg;
if (isnan(arg)) for (int i = 0; i < 3; ++i) *--last = i["NaN"];
else if (isinf(arg)) for (int i = 0; i < 3; ++i) *--last = i["fnI"];
else {
auto integerPart = static_cast<unsigned long long>(arg);
auto fractionalPart = static_cast<unsigned long long>((arg - integerPart) * basePower + F(0.5));
if (fractionalPart >= basePower) ++integerPart, fractionalPart = 0;
char* point = last - precision;
if (precision > 0) {
::fill(point, writeUnsignedInt(fractionalPart, last), '0');
*--point = '.';
}
last = writeUnsignedInt(integerPart, point);
}
if (negative) *--last = '-';
return last;
}
inline int writeT(char* first) {
int delimiterLenght = separate ? writeDelimiter() : 0;
separate = true;
uint charsWritten = static_cast<uint>(end - first);
if (__builtin_expect(charsWritten < width, false))
charsWritten += writeFill(width - charsWritten);
output = copy(first, end, output);
flushMaybe();
return delimiterLenght + static_cast<int>(charsWritten);
}
inline int writeFill(uint count) {
int charsWritten = static_cast<int>(count);
if (__builtin_expect(output + count + MAX_LENGTH < end, true)) {
if (count == 1) *output++ = fill;
else output = fill_n(output, count, fill);
} else for (uint chunkSize = static_cast<uint>(buffer + BUFFER_SIZE - output);; chunkSize = BUFFER_SIZE) {
if (chunkSize > count) chunkSize = count;
output = fill_n(output, chunkSize, fill);
flushMaybe();
if ((count -= chunkSize) == 0) break;
}
return charsWritten;
}
public:
uint width;
char fill;
uint base;
uint precision;
unsigned long long basePower;
string delimiter;
OutputDevice(OutputDevice const&) = delete;
OutputDevice& operator = (OutputDevice const&) = delete;
virtual ~OutputDevice() {};
inline int writeChar(char arg) { separate = false; *output++ = arg; flushMaybe(); return 1; }
inline int writeString(const char* arg, size_t length, bool checkWidth = true) {
separate = false;
uint count = static_cast<uint>(length);
int charsWritten = static_cast<int>(count) + (checkWidth && count < width ? writeFill(width - count) : 0);
if (__builtin_expect(output + count + MAX_LENGTH < end, true)) {
if (count == 1) *output++ = *arg;
else output = copy_n(arg, count, output);
} else for (uint chunkSize = static_cast<uint>(buffer + BUFFER_SIZE - output);; chunkSize = BUFFER_SIZE) {
if (chunkSize > count) chunkSize = count;
output = copy_n(arg, chunkSize, output);
flushMaybe();
if ((count -= chunkSize) == 0) break;
arg += chunkSize;
}
return charsWritten;
}
inline int writeDelimiter() { return writeString(delimiter.c_str(), delimiter.size(), false); }
inline void flush() {
writeToDevice(static_cast<uint>(output - buffer));
output = buffer;
}
// property setters
inline int write(Detail::Width newWidth) { width = newWidth.value; return 0; }
inline int write(Detail::Fill newFill) { fill = newFill.value; return 0; }
inline int write(Detail::Base newBase) { base = newBase.value; computeBasePower(); return 0; }
inline int write(Detail::Precision newPrecision) {
precision = newPrecision.value; computeBasePower(); return 0;
}
inline int write(Detail::Delimiter newDelimiter) { delimiter = newDelimiter.value; return 0; }
// primitive types
inline int write() { return 0; }
inline int write(char arg) { return writeChar(arg); }
template <class I> inline typename enable_if<is_integral<I>::value && is_unsigned<I>::value,
int>::type write(I arg) { return writeT(writeUnsignedInt(arg, end)); }
template <class I> inline typename enable_if<is_integral<I>::value && is_signed<I>::value,
int>::type write(I arg) { return writeT(writeSignedInt(arg, end)); }
template <class F> inline typename enable_if<is_floating_point<F>::value,
int>::type write(F arg) { return writeT(writeFloatingPoint(arg, end)); }
// complex types
inline int write(const char* arg) { return writeString(arg, strlen(arg)); }
template <int N>
inline int write(char (&arg)[N]) { return writeString(arg, strlen(arg)); }
inline int write(const string& arg) { return writeString(arg.c_str(), arg.size()); }
template <class T1, class T2>
inline int write(const pair<T1, T2>& arg) {
int charsWritten = write(arg.first);
charsWritten += writeDelimiter();
return charsWritten + write(arg.second);
}
template <class T>
inline int write(const complex<T>& arg) { return write(real(arg), imag(arg)); }
// ranges
template <class Iterator, class... Ts> inline typename enable_if<is_iterator<Iterator>::value,
int>::type write(Iterator first, Iterator last, Ts&&... args) {
int charsWritten = 0;
for (; first != last; charsWritten += ++first == last ? 0 : writeDelimiter()) charsWritten += write(*first);
return charsWritten + write(forward<Ts>(args)...);
}
template <class Iterator, class I, class... Ts>
inline typename enable_if<is_iterator<Iterator>::value && is_integral<I>::value,
int>::type write(Iterator first, I count, Ts&&... args) { return write(first, first + count, forward<Ts>(args)...); }
// generic forwarding
template <class T>
inline auto write(const T& arg) -> decltype(arg.write(*this)) { return arg.write(*this); }
template <class T0, class T1, class... Ts> inline typename enable_if<!is_iterator<T0>::value,
int>::type write(T0&& arg0, T1&& arg1, Ts&&... args) {
int charsWritten = write(forward<T0>(arg0));
return charsWritten + write(forward<T1>(arg1), forward<Ts>(args)...);
}
};
class OutputFile : public OutputDevice {
FILE* file;
bool owner;
void writeToDevice(uint count) override {
fwrite(buffer, 1, count, file);
fflush(file);
}
public:
OutputFile(FILE* file = stdout, bool takeOwnership = false) : file(file), owner(takeOwnership) {}
OutputFile(const char* fileName) : OutputFile(fopen(fileName, "w"), true) {}
~OutputFile() override { flush(); if (owner) fclose(file); }
};
class OutputString : public OutputDevice {
string& str;
void writeToDevice(uint count) override { str.append(buffer, count); }
public:
OutputString(string& str) : OutputDevice(), str(str) {}
~OutputString() override { flush(); }
};
unique_ptr<InputDevice> input;
unique_ptr<OutputDevice> output;
template <class... Ts> inline bool read(Ts&&... args) { return input->read(forward<Ts>(args)...); }
template <class... Ts> inline int write(Ts&&... args) { return output->write(forward<Ts>(args)...); }
template <class... Ts> inline int writeln(Ts&&... args) { return write(forward<Ts>(args)..., '\n'); }
void flush() { output->flush(); }
using pi = pair<int,int>;
#define sz(x) int((x).size())
template<class F> struct Dinic {
struct Edge { int to, rev; F cap; };
int N; vector<vector<Edge>> adj;
void init(int _N) { N = _N; adj.resize(N); } //0-based
pi ae(int a, int b, F cap, F rcap = 0) {
assert(min(cap,rcap) >= 0); // saved me > once
adj[a].push_back({b,sz(adj[b]),cap});
adj[b].push_back({a,sz(adj[a])-1,rcap});
return {a,sz(adj[a])-1};
}
F edgeFlow(pi loc) { // get flow along original edge
const Edge& e = adj.at(loc.first).at(loc.second);
return adj.at(e.to).at(e.rev).cap;
}
vector<int> lev, ptr;
bool bfs(int s,int t){//level=shortest dist from source
lev = ptr = vector<int>(N);
lev[s] = 1; queue<int> q({s});
while (sz(q)) { int u = q.front(); q.pop();
for(auto& e: adj[u]) if (e.cap && !lev[e.to]) {
q.push(e.to), lev[e.to] = lev[u]+1;
if (e.to == t) return 1;
}
}
return 0;
}
F dfs(int v, int t, F flo) {
if (v == t) return flo;
for (int& i = ptr[v]; i < sz(adj[v]); i++) {
Edge& e = adj[v][i];
if (lev[e.to]!=lev[v]+1||!e.cap) continue;
if (F df = dfs(e.to,t,min(flo,e.cap))) {
e.cap -= df; adj[e.to][e.rev].cap += df;
return df; } // saturated $\geq1$ one edge
}
return 0;
}
F maxFlow(int s, int t) {
F tot = 0; while (bfs(s,t)) while (F df =
dfs(s,t,numeric_limits<F>::max())) tot += df;
return tot;
}
};
void solve(int t){
input.reset(new InputFile(stdin, false));
output.reset(new OutputFile());
int n;
//cin>>n;
read(n);
vector<string> mat(n," ");
for(int i=0;i<n;i++){
read(mat[i]);
}
vector r(n,0),c(n,0);
for(int i=0;i<n;i++)read(r[i]);//cin>>r[i];
for(int i=0;i<n;i++)read(c[i]);//cin>>c[i];
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(mat[i][j]=='-'){
r[i]++;
c[j]++;
}
}
}
long long totr=0,totc=0;
for(int i=0;i<n;i++){
if(r[i]<0 || c[i]<0){
cout<<"No\n";
return;
}
totr+=r[i];
totc+=c[i];
}
if(totr!=totc){
cout<<"No\n";
}else{
Dinic<int> ds;
int source = 2*n;
int sink = 2*n+1;
ds.init(2*n+2);
for(int i=0;i<n;i++){
ds.ae(source,i,r[i]);
ds.ae(n+i,sink,c[i]);
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
ds.ae(i,n+j,1);
}
}
if(ds.maxFlow(source,sink)!=totr){
cout<<"No\n";
}else{
vector ok(n,vector(n,false));
for(int i=0;i<n;i++){
for(auto j : ds.adj[i]){
if(j.to>=n && j.cap==0){
ok[i][j.to-n]=true;
}
}
}
writeln("Yes");
for(int i=0;i<n;i++){
string tmp;
tmp.resize(n);
for(int j=0;j<n;j++){
if(ok[i][j]^(mat[i][j]=='+')){
tmp[j]='0';
}else{
tmp[j]='1';
}
}
writeln(tmp);
}
}
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)solve(i);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3472kb
input:
3 +-+ -++ +-+ 1 1 1 1 -1 3
output:
Yes 001 001 111
result:
ok n=3
Test #2:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
3 --- -++ +++ -2 -1 0 -2 -1 0
output:
Yes 110 100 000
result:
ok n=3
Test #3:
score: 0
Accepted
time: 1ms
memory: 3540kb
input:
3 +-+ -++ ++- 1 0 2 2 2 -1
output:
No
result:
ok n=3
Test #4:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
1 - -1 1
output:
No
result:
ok n=1
Test #5:
score: 0
Accepted
time: 0ms
memory: 3472kb
input:
1 - 0 0
output:
Yes 0
result:
ok n=1
Test #6:
score: 0
Accepted
time: 1ms
memory: 3560kb
input:
20 +-------+-----+++-++ -+-++++----++-++-++- -+++--+---+--+-++--- -+++-+--+----++---+- +++-+-++++++-+-+---+ -++-----+----++++++- +-++--+++++-++-+---- +-+----+---+-+++--+- +++++-+++++----+--+- ------++++---+--++-- ++++--------++++--+- -+-+-++++-+-++-++--+ ---+-++---+-++-++--- +-++++-++----+-+++-- +-+...
output:
Yes 01111000100100101110 10101110000100100011 10000010000111101100 10010100011111010111 00101011111100100100 11100001100110001001 00110010000100101101 00100000000100001101 00011000111001101101 11110000100001000011 00000011010000001101 10100000110011011010 00010001110011011000 10100010011001011100 01...
result:
ok n=20
Test #7:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
100 ++++-+-+--++++++-+--+--++-+-+--+++++-+++---+-+-+-++-+-+++-------+-++--+-++--+--+++++-++-+---+--+--++ -++--++-+-++++-+---++-+-+-+-+-+-+-+-+--+-+--+--+++---+--+-----+-----+-++-++-+-++++++--+-+++-+++-++++ --+---++-++--++-+++-------+--+-++------+-----+--+----++++++++-+--+++++--++--+-+-+++---+--+++-+...
output:
Yes 0110001011100010101101100110100111110111000101010110101110000000101100101100111111110110100010010011 0111001110100000011001010110101010101001010010011100010010000010000010110110101111110010111011101111 1011010010111011011000000001101011110001000001001000011111111010011111001100101011100010011101...
result:
ok n=100
Test #8:
score: 0
Accepted
time: 7ms
memory: 9904kb
input:
500 --+-+-+-++-----+++--+-+++-+---+-+-------+++--++++++-+--++--+-+-++++-++++--++--+---++--++----++--+---++-++--+-----+-+---++-++++-+++++++---++-++--+-++++-+----++-+++-+++---+--+++-+--++-++--+++++++-+++--+---+---+-+---++-+-+--+-+++-++-----+++-++-+++-+-++--++++++-+-++-+++---++-+++-++----+--+++----++++...
output:
Yes 11010101001111100011010001011101011111110001100111101001100101011110111100110010001100110000110010010010011011111010111001000010000000111001001101000010111100100010001110110001011001001100000001000110111011101011100101011010001001111100010010001010011000000101001000111001000100111101100011110000...
result:
ok n=500
Test #9:
score: 0
Accepted
time: 795ms
memory: 406120kb
input:
4000 -++-+-+-+--+-++++---+-++------++---+-+++--+++--+++++++---+-++-+++++++----+---+++-++--++---+-++--+----+---+--++-+-+-+-----+-+---++-++--+---+++-++++-+-----++--++-++---++-+--+++-+--+--+-+-++-+++--++---+++-+-+---+++-++-+-++-+-+++---+++---+-+--++---+-+---+--+++--+----+-+--++---+-----+-+--+----+-+++-...
output:
Yes 10010101011010000111010011111100111010001100011000000011101001000000011110111000100110011101001101111011101011010101000001010001101100100011101111010000011001101100011010011101001001010110111001100011101010001110110101101011100011100010100110001010001001110010000101001100010000010100100001011101...
result:
ok n=4000
Test #10:
score: 0
Accepted
time: 700ms
memory: 406172kb
input:
4000 +---+--++-+--++-+-++--+++--++--+++-+-+-+--++++++-++-+-+++-+---++++-+-+++----++-+---++--++--+++-----++---++-+--++++----++--++--+-+-++--+--+++++-+---+++-+++--++++-++-+++++++----+++-----+--++-+++-++-++-+++-+--++++++-+--++--+-+---++--------+-+--++----+-++-+-++---+--++--+-+--+-+++-+--+--++++-++----+...
output:
Yes 01110110010110010100110001100110001010101100000010010100010111000010100011110010111001100110001111100111001011000011110011001101010011011000001011100010001100001001000000011110001111101100100010010010001011000000101100110101110011111111010110011111011010110001001100101001011101001001111011000010...
result:
ok n=4000
Test #11:
score: 0
Accepted
time: 1021ms
memory: 406188kb
input:
4000 -+--+------+--+++-++-----++--+-++-++-++-+-+-++++++--++--+-++-+-+++---++-+-+++++-++++++-+-++-++-++-+-++---+-+-------++-+++-++-+-++++-++-+-+-----+----+--+----++++-------++-+--+++----+++++++-+--+-+---+-+++++-+-----++-------++++--+-+-++---++++-++++-++-+++-+-++---+--+---+-++++++--++---+-++++++-+-+--...
output:
Yes 10110111111011000100111110011010010010010101000000110011010010100011100101000001000000101001001001010011101011111110010001001010000100101011111011110110111100001111111001011000111100000001011010111010000010111110011111110000110101001110000100001001000101001110110111010000001100111010000001010111...
result:
ok n=4000
Test #12:
score: 0
Accepted
time: 819ms
memory: 406076kb
input:
4000 +-+-----++++-----++++-+-++-+----+++---++--+---+++-+-++------+-+-++++----+-++++--+-++----+-+---+--+-----+-++--++-+++---+---+++---++-+++---++++---++----+++--+---+---+++-++-+-+-+--+++--++----++-+------+++-++-++--+--+++---+-------++++-+-++--++-+--+------+++++---+---++-++++-+++-++++-+---++-++++----+...
output:
Yes 01011111000011111000010100101111000111001101110001010011111101010000111101000011010011110101110110111110100110010001110111000111001000111000011100111100011011101110001001010101100011001111001011111100010010011011000111011111110000101001100101101111110000011101110010000100010000101110010000111100...
result:
ok n=4000
Test #13:
score: 0
Accepted
time: 925ms
memory: 406128kb
input:
4000 -+++---+-------+-++++-+++-++-+--++----++++++---+---++-++++-+++-++++-+---+--+++-----+-+--++-+--+-++++--+--++-+---+++++++++-+++++++-+++--+-+---++-+-++----+-++--++-++++++++++++++-+++-++-+++-++-++---+---+++-+-+++++++--+-+++-++-+-----+++-++--+++------+++--+++---+--+----++-+--+-+---+--+---+-+-+--++++...
output:
Yes 10001110111111101000010001001011001111000000111011100100001000100001011101100011111010110010110100001101100101110000000001000000010001101011100101001111010011001000000000000001000100100010010011101110001010000000110100010010111110001001100011111100011000111011011110010110101110110111010101100001...
result:
ok n=4000
Test #14:
score: 0
Accepted
time: 581ms
memory: 406080kb
input:
4000 +--+++++--++--+-+++-++-+-+-+-+--++------++++---+++-+-+--+------++-+--++-+-+++-----+-+++++-+------++++-++++-+--+------++--+++++-+-+--+-+++++++++++++++-+--+-+-+---+-+-+++++-++--+-+---++-++--+--+-+++-+-+++++-+--++-+----+++-++-++++-+---+--+-++-++-+-+-+---++-++-+-+----++-++++-----------+++--++++-++-...
output:
Yes 01100000110011010001001010101011001111110000111000101011011111100101100101000111110100000101111110000100001011011111100110000010101101000000000000000101101010111010111111011001010001101100100101110101111101001101000011101101111010001001011011010101000110110101000011011110000000000011100111101101...
result:
ok n=4000
Test #15:
score: 0
Accepted
time: 1224ms
memory: 406112kb
input:
4000 ---++-++-+-+----++-++++-----------+++--++++-++-++--+-+--+--+-+-++++--++-++--+++++--++--+-+----+-+---++-+++-+--+-++++++++-++---++++-+--+-+++---+-+--+--+-+--+--++++++-+---++++++-++++----+-+-+-++--+---+--+-+++--++++++-+++-+---+--+-----------++-+++--+++++++--++-+++++--+++-+-+++++++++--+---+++--+-+-...
output:
Yes 10011000110100001001111010000010001110011100110110011000110101010111011000000101100110010000001011000111100101101011011101100000011100001100001100010111001111100100010101101111100100001001100001001001010001001001110011011001001100010000001001001101111111001001110000110101011011110110001100010110...
result:
ok n=4000
Test #16:
score: -100
Time Limit Exceeded
input:
4000 ++-+-------+--++-++-++--++-+++++-++++--+-----++-+--+---++++--+-----++++++---+--+---+------+++-+-----+-+++--+++-+-+-+++-----++---+-+---+-+++++-+--+-++--++-+-----++-+-+---+++-+----++++---++--+-+-++-++-+--++---+++------++-+-++++--+--++-++-+++-++-+--++----++---+-+++-+-+++-++-+--++-++++--++-+-+-+-+-...