QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#631346#7857. (-1,1)-SumpleteevirirRE 1492ms128916kbC++201.3kb2024-10-12 01:03:432024-10-12 01:03:44

Judging History

你现在查看的是最新测评结果

  • [2024-10-12 01:03:44]
  • 评测
  • 测评结果:RE
  • 用时:1492ms
  • 内存:128916kb
  • [2024-10-12 01:03:43]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a ; i <(b) ; ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef __int128 ll ;
typedef pair<int, int> pii;
typedef vector<int> vi;
int g[4000][4000];
int ans[4000][4000];
int main()
{
	cin.tie(0)->sync_with_stdio(0);
	//cin.exceptions(cin.failbit);

	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			char c;
			cin>>c;
			if(c=='+')g[i][j] = 1;
			else g[i][j] = -1;
			//cout<<g[i][j];
		}
	}
	vector<int>r(n),c(n);
	for(int i=0;i<n;i++)cin>>r[i];
	for(int i=0;i<n;i++)cin>>c[i];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
            if(g[i][j] == -1){
				ans[i][j] = 1;
				r[i]++;
				c[j]++;
			}				
		}
	}
	//for(int i=0;i<n;i++)cout<<r[i]<<" ";cout<<'\n';
	//for(int i=0;i<n;i++)cout<<c[i]<<" ";cout<<'\n';
	for(int i=0;i<n;i++){
		vector<pii>a;
		for(int j=0;j<n;j++)a.push_back({c[j],j});			
		sort(all(a));
		reverse(all(a));
		int s = r[i];
		for(int j=0;j<s;j++){
			int  k = a[j].second;
			r[i]--;
			c[k]--;
			ans[i][k] ^= 1;
		}
	}
	for(int i=0;i<n;i++){
		if(r[i] || c[i]){
			cout<<"No"<<'\n';
			return 0;
		}
	}
	cout<<"Yes"<<'\n';
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
            cout<<ans[i][j];			
		}
		cout<<'\n';
	}
	
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5616kb

input:

3
+-+
-++
+-+
1 1 1
1 -1 3

output:

Yes
111
111
111

result:

ok n=3

Test #2:

score: 0
Accepted
time: 1ms
memory: 5696kb

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: 5620kb

input:

3
+-+
-++
++-
1 0 2
2 2 -1

output:

No

result:

ok n=3

Test #4:

score: 0
Accepted
time: 1ms
memory: 5860kb

input:

1
-
-1
1

output:

No

result:

ok n=1

Test #5:

score: 0
Accepted
time: 1ms
memory: 5644kb

input:

1
-
0
0

output:

Yes
0

result:

ok n=1

Test #6:

score: 0
Accepted
time: 0ms
memory: 5644kb

input:

20
+-------+-----+++-++
-+-++++----++-++-++-
-+++--+---+--+-++---
-+++-+--+----++---+-
+++-+-++++++-+-+---+
-++-----+----++++++-
+-++--+++++-++-+----
+-+----+---+-+++--+-
+++++-+++++----+--+-
------++++---+--++--
++++--------++++--+-
-+-+-++++-+-++-++--+
---+-++---+-++-++---
+-++++-++----+-+++--
+-+...

output:

Yes
01100011111000111110
10101101010110110010
10000011010001001101
10000111011001110111
01101100000101010001
10010101100101101011
01010000000111100101
10111110111001110010
00000110111000100101
00000000001110111000
00001111111101110001
10100111101010100110
00011001111011011000
10111101101110100000
01...

result:

ok n=20

Test #7:

score: 0
Accepted
time: 2ms
memory: 8004kb

input:

100
++++-+-+--++++++-+--+--++-+-+--+++++-+++---+-+-+-++-+-+++-------+-++--+-++--+--+++++-++-+---+--+--++
-++--++-+-++++-+---++-+-+-+-+-+-+-+-+--+-+--+--+++---+--+-----+-----+-++-++-+-++++++--+-+++-+++-++++
--+---++-++--++-+++-------+--+-++------+-----+--+----++++++++-+--+++++--++--+-+-+++---+--+++-+...

output:

Yes
1110010000111010000001100110001111110111001101011111101100000000101100101100111111100010100010011010
0111011110111001000111000110000010101001011010011100010000000010000010110110110111100110111011100111
0011001001100010111001101010111110000000001001000001011101111110011010001100110011110110011101...

result:

ok n=100

Test #8:

score: 0
Accepted
time: 14ms
memory: 22528kb

input:

500
--+-+-+-++-----+++--+-+++-+---+-+-------+++--++++++-+--++--+-+-++++-++++--++--+---++--++----++--+---++-++--+-----+-+---++-++++-+++++++---++-++--+-++++-+----++-+++-+++---+--+++-+--++-++--+++++++-+++--+---+---+-+---++-+-+--+-+++-++-----+++-++-+++-+-++--++++++-+-++-+++---++-+++-++----+--+++----++++...

output:

Yes
11000101000110101011000011011101010111110101100000010100010011001001001011001001101011001111001101110010111011111010001101000000000000011001011100010010011100100010001110110101011111011100001100000010001111101011100100011010010011111100010111100110011000000100001100111011000101101101100011101000...

result:

ok n=500

Test #9:

score: 0
Accepted
time: 1051ms
memory: 128688kb

input:

4000
-++-+-+-+--+-++++---+-++------++---+-+++--+++--+++++++---+-++-+++++++----+---+++-++--++---+-++--+----+---+--++-+-+-+-----+-+---++-++--+---+++-++++-+-----++--++-++---++-+--+++-+--+--+-+-++-+++--++---+++-+-+---+++-++-+-++-+-+++---+++---+-+--++---+-+---+--+++--+----+-+--++---+-----+-+--+----+-+++-...

output:

Yes
00010101011111000010100011111010100011011110001100011011110111110010101110011000100111001001000011010101101000101111011111001011010000000101000000101011101111001011110111100010110110001001110111111001011101000001100110101100110100101101001011110110110110011111010010010000111111101111001000101011...

result:

ok n=4000

Test #10:

score: 0
Accepted
time: 931ms
memory: 128656kb

input:

4000
+---+--++-+--++-+-++--+++--++--+++-+-+-+--++++++-++-+-+++-+---++++-+-+++----++-+---++--++--+++-----++---++-+--++++----++--++--+-+-++--+--+++++-+---+++-+++--++++-++-+++++++----+++-----+--++-+++-++-++-+++-+--++++++-+--++--+-+---++--------+-+--++----+-++-+-++---+--++--+-+--+-+++-+--+--++++-++----+...

output:

Yes
00110011010110001110111001100110100010110011000010111011010101000110100011010100010010111110101111111111100011010101011001000111010111010010100101110011101110100111001000010101000101100001101110000000101001010001100110000111010001011101100110110100100111001110110011110011101000100111010111001111...

result:

ok n=4000

Test #11:

score: 0
Accepted
time: 853ms
memory: 128712kb

input:

4000
-+--+------+--+++-++-----++--+-++-++-++-+-+-++++++--++--+-++-+-+++---++-+-+++++-++++++-+-++-++-++-+-++---+-+-------++-+++-++-+-++++-++-+-+-----+----+--+----++++-------++-+--+++----+++++++-+--+-+---+-+++++-+-----++-------++++--+-+-++---++++-++++-++-+++-+-++---+--+---+-++++++--++---+-++++++-+-+--...

output:

Yes
10111100000101101010001100000111001111100110001111110110101101111110110001011110110101010110010101111101101001100001001100110101010111010100000101001100101111000100001100000101010011001011100101100000101101100000101110100111000001100001011111110111001000010011001001101100001110010101010110101001...

result:

ok n=4000

Test #12:

score: 0
Accepted
time: 981ms
memory: 128664kb

input:

4000
+-+-----++++-----++++-+-++-+----+++---++--+---+++-+-++------+-+-++++----+-++++--+-++----+-+---+--+-----+-++--++-+++---+---+++---++-+++---++++---++----+++--+---+---+++-++-+-+-+--+++--++----++-+------+++-++-++--+--+++---+-------++++-+-++--++-+--+------+++++---+---++-++++-+++-++++-+---++-++++----+...

output:

Yes
01110110000111011000001000111111110100001011111011000001010101000011101001100011101010100001000111101010111010000011110100001110111100111000010111110101000001101000101011000101110001000101111001000111010011101011101100011011100101000000101101110111011100111101101011100111001000001100111101110111...

result:

ok n=4000

Test #13:

score: 0
Accepted
time: 1001ms
memory: 128748kb

input:

4000
-+++---+-------+-++++-+++-++-+--++----++++++---+---++-++++-+++-++++-+---+--+++-----+-+--++-+--+-++++--+--++-+---+++++++++-+++++++-+++--+-+---++-+-++----+-++--++-++++++++++++++-+++-++-+++-++-++---+---+++-+-+++++++--+-+++-++-+-----+++-++--+++------+++--+++---+--+----++-+--+-+---+--+---+-+-+--++++...

output:

Yes
10001100011101010111111010100100101000010100100011110000000110000111000000111010001111010101001111110010011001101110110111111011000010100000001010011100101110100001110111110110000111011000101010000111110001111011000010011000100010101100111101110001010111010000000000111001010101000100100111010011...

result:

ok n=4000

Test #14:

score: 0
Accepted
time: 972ms
memory: 128660kb

input:

4000
+--+++++--++--+-+++-++-+-+-+-+--++------++++---+++-+-+--+------++-+--++-+-+++-----+-+++++-+------++++-++++-+--+------++--+++++-+-+--+-+++++++++++++++-+--+-+-+---+-+-+++++-++--+-+---++-++--+--+-+++-+-+++++-+--++-+----+++-++-++++-+---+--+-++-++-+-+-+---++-++-+-+----++-++++-----------+++--++++-++-...

output:

Yes
01100000110011010001001010101011001111110001111100100011011110100110101101000111110100000100100110000100000011011111100110000010101101000001000000000101111010111010100100100110101110000101111000001010000010110010111100010010011101110110100100101111110011011010101100100001111111011100001000010010...

result:

ok n=4000

Test #15:

score: 0
Accepted
time: 1002ms
memory: 128644kb

input:

4000
---++-++-+-+----++-++++-----------+++--++++-++-++--+-+--+--+-+-++++--++-++--+++++--++--+-+----+-+---++-+++-+--+-++++++++-++---++++-+--+-+++---+-+--+--+-+--+--++++++-+---++++++-++++----+-+-+-++--+---+--+-+++--++++++-+++-+---+--+-----------++-+++--+++++++--++-+++++--+++-+-+++++++++--+---+++--+-+-...

output:

Yes
00011010010100001101111000000000001110011110110110011100100101010111011010001101100110010000001011001111100100101111011101100000111100101100001000010010001100111100010101101111111100001000100001001000010011001111110111011001001100000000001101101101111110011011111001110101111011110010001100010110...

result:

ok n=4000

Test #16:

score: 0
Accepted
time: 1492ms
memory: 128912kb

input:

4000
++-+-------+--++-++-++--++-+++++-++++--+-----++-+--+---++++--+-----++++++---+--+---+------+++-+-----+-+++--+++-+-+-+++-----++---+-+---+-+++++-+--+-++--++-+-----++-+-+---+++-+----++++---++--+-+-++-++-+--++---+++------++-+-++++--+--++-++-+++-++-+--++----++---+-+++-+-+++-++-+--++-++++--++-+-+-+-+-...

output:

Yes
10011000000100110011110001111011011110010000011110010001111001000001111110000001000100000010101000001011100111010101110000011000101000101111101001011001101000001101010001110101001111001110010110101101001110011100000011011111100100110110111011010011000001000100110101110110100110110100110101010110...

result:

ok n=4000

Test #17:

score: 0
Accepted
time: 1492ms
memory: 128872kb

input:

3999
-+-+++---+-----++-++-+++--++-++-----+-++-+---+++-+++-+-+--+++++-++-+++-+---+-----+-++++-+--++-+++--+-++++--+-+-+-+-+----++----+--+---+--+--++-+++--++-+-++--++------+-+--++++--++-+--+----++---+-+---+++++--++-+-++-+++--++---++++-+-+--+-+++++-+-+--+---+---+-+--++++---+-++++-+--++------+++-+++-+-+-...

output:

Yes
10100010101111100110100011001001011101001011100010001011100000010010001011101111101000010110010001101000011010101010110100011101101110110110010101100101001100111111010110000110010110111100101010111000001100101001000110010100001010110100100101011011101110101100001110100001011001111110001000001010...

result:

ok n=3999

Test #18:

score: 0
Accepted
time: 1481ms
memory: 128680kb

input:

3998
--------+++--++-++++--+-+-++---+--++---++-+-++--+----++++---+-++-+-++++++++-+-+++---++++++-+--+-------+--+----++--+--+-+--+++---++-+++---+++-++-+++--++-+----+---+--+-++++--++++-++-+-+---+---+-++----+++++++++++--++--+++++-+++++++-+-+--+-+---+++-++-+++++-+-+-+-+++-+-++-+-+--+-+----+++-+-+--++-+--...

output:

Yes
11111110011000110001110000010110001000110100111101110110000111000100001000101000001010101100001111110001001001011100100000110010101001101011001101110110011110100001100110010111010010100001011111011000100010110001100000001110011001011010111001111011000000010110101001010001000110100000100110000010...

result:

ok n=3998

Test #19:

score: 0
Accepted
time: 1043ms
memory: 128916kb

input:

4000
++-+-------+--++-++-++--++-+++++-++++--+-----++-+--+---++++--+-----++++++---+--+---+------+++-+-----+-+++--+++-+-+-+++-----++---+-+---+-+++++-+--+-++--++-+-----++-+-+---+++-+----++++---++--+-+-++-++-+--++---+++------++-+-++++--+--++-++-+++-++-+--++----++---+-+++-+-+++-++-+--++-++++--++-+-+-+-+-...

output:

No

result:

ok n=4000

Test #20:

score: 0
Accepted
time: 1015ms
memory: 128588kb

input:

3999
-+-+++---+-----++-++-+++--++-++-----+-++-+---+++-+++-+-+--+++++-++-+++-+---+-----+-++++-+--++-+++--+-++++--+-+-+-+-+----++----+--+---+--+--++-+++--++-+-++--++------+-+--++++--++-+--+----++---+-+---+++++--++-+-++-+++--++---++++-+-+--+-+++++-+-+--+---+---+-+--++++---+-++++-+--++------+++-+++-+-+-...

output:

No

result:

ok n=3999

Test #21:

score: 0
Accepted
time: 1037ms
memory: 128916kb

input:

3998
--------+++--++-++++--+-+-++---+--++---++-+-++--+----++++---+-++-+-++++++++-+-+++---++++++-+--+-------+--+----++--+--+-+--+++---++-+++---+++-++-+++--++-+----+---+--+-++++--++++-++-+-+---+---+-++----+++++++++++--++--+++++-+++++++-+-+--+-+---+++-++-+++++-+-+-+-+++-+-++-+-+--+-+----+++-+-+--++-+--...

output:

No

result:

ok n=3998

Test #22:

score: 0
Accepted
time: 1ms
memory: 5828kb

input:

2
+-
--
0 -1
-1 2

output:

No

result:

ok n=2

Test #23:

score: 0
Accepted
time: 1ms
memory: 7900kb

input:

20
--+--------+---++-++
--+++-+----+--++-+++
-+-+-++++---+-+---++
+++-++--++-++-++--++
+---+----+-+++-++++-
----+++++--++----+-+
+-++++----++--++----
++++++-+-+-++-++--+-
-+--+-++++-+-+-+-+-+
--++-+-+--++-++--++-
+---+++-+++-+-+-++-+
+++-+--+++-++-+++-+-
--++--+-++-+--+-+-++
----++-+--+-+-++++-+
--+...

output:

No

result:

ok n=20

Test #24:

score: -100
Runtime Error

input:

4000
++---+++-+++-++++++----++-+-+----+-+----+-+-+---+--+-+-----+-+--++++++-++-++++-++----+-++---++++++--+++++--+++--++++-+-+++-++++-+--+++-+++-+--+-+-+++-+-+-+-+++-+-++-++-++++-++-+-++----++++-++++++--+-+---++--+++-++-+-+----+++--+-+--++----+-+++-+-------+++-++--+++-+--+-++----+--------++++--+--+-+...

output:


result: