CSES - HIIT Open 2017 - Results
Submission details
Task:Grid
Sender:Game of Nolife
Submission time:2017-05-27 11:53:48 +0300
Language:C++
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.05 sdetails
#2ACCEPTED0.04 sdetails
#3ACCEPTED0.06 sdetails
#4ACCEPTED0.04 sdetails
#5ACCEPTED0.05 sdetails
#6ACCEPTED0.07 sdetails
#7ACCEPTED0.08 sdetails
#8ACCEPTED0.06 sdetails
#9ACCEPTED0.04 sdetails
#10ACCEPTED0.04 sdetails
#11ACCEPTED0.06 sdetails
#12ACCEPTED0.04 sdetails
#13ACCEPTED0.04 sdetails
#14ACCEPTED0.06 sdetails
#15ACCEPTED0.03 sdetails
#16ACCEPTED0.06 sdetails
#17ACCEPTED0.05 sdetails
#18ACCEPTED0.03 sdetails
#19ACCEPTED0.05 sdetails
#20ACCEPTED0.03 sdetails
#21ACCEPTED0.06 sdetails
#22ACCEPTED0.04 sdetails
#23ACCEPTED1.59 sdetails
#24ACCEPTED1.42 sdetails
#25ACCEPTED1.46 sdetails
#26ACCEPTED1.47 sdetails
#27ACCEPTED1.35 sdetails

Code

#include <bits/stdc++.h>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;

const int S=3000;

bitset<S> lol[S];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	for (int i=0;i<n;i++){
		string s;
		cin>>s;
		for (int j=0;j<m;j++){
			if (s[j]=='1') lol[i][j]=1;
		}
	}
	ll ans=0;
	for (int i=0;i<n;i++){
		for (int ii=i+1;ii<n;ii++){
			ll t=(lol[i]&lol[ii]).count();
			ans+=t*(t-1)/2;
		}
	}
	cout<<ans<<endl;
}

Test details

Test 1

Verdict: ACCEPTED

input
10 20
11111111111111111111
11111111111111111111
11111111111111111111
11111111111111111111
...

correct output
8379

user output
8379

Test 2

Verdict: ACCEPTED

input
20 10
1111111111
1101111111
1111111111
1111111111
...

correct output
7880

user output
7880

Test 3

Verdict: ACCEPTED

input
10 20
11111111010111111101
11111110011011111111
11111100011111111111
11101111111111111111
...

correct output
5106

user output
5106

Test 4

Verdict: ACCEPTED

input
20 10
1111100111
1111111111
1011111110
1111111111
...

correct output
4563

user output
4563

Test 5

Verdict: ACCEPTED

input
10 20
11011011011111111110
11111010110110110001
11010010111101111010
01111111111110101111
...

correct output
3099

user output
3099

Test 6

Verdict: ACCEPTED

input
20 10
1110111111
1111111111
1101101110
0111110011
...

correct output
2973

user output
2973

Test 7

Verdict: ACCEPTED

input
10 20
01101101111101110101
10011111111111110111
01111101011010110011
10110101110110101011
...

correct output
2581

user output
2581

Test 8

Verdict: ACCEPTED

input
20 10
1110111001
0111001001
1111011011
1111111010
...

correct output
1660

user output
1660

Test 9

Verdict: ACCEPTED

input
10 20
11000000001100011111
11100111101100110110
11001110011110110101
10100001111011001111
...

correct output
1015

user output
1015

Test 10

Verdict: ACCEPTED

input
20 10
1000011001
1101111110
1000111111
1101101010
...

correct output
1135

user output
1135

Test 11

Verdict: ACCEPTED

input
10 20
10000101101101000110
00100010110011011011
11110111110101101011
11101100011101001011
...

correct output
708

user output
708

Test 12

Verdict: ACCEPTED

input
20 10
1000011111
0001001100
0101110110
1111110001
...

correct output
394

user output
394

Test 13

Verdict: ACCEPTED

input
10 20
00010111101111010011
11010001011010010110
10011001011010100011
01100011001000001100
...

correct output
294

user output
294

Test 14

Verdict: ACCEPTED

input
20 10
0011001110
0000001111
1011100000
0000001001
...

correct output
166

user output
166

Test 15

Verdict: ACCEPTED

input
10 20
10011010001011000110
00100000100000000000
00000110001000110001
01000000101100110101
...

correct output
87

user output
87

Test 16

Verdict: ACCEPTED

input
20 10
0000110101
1000000001
0101100110
0100001010
...

correct output
134

user output
134

Test 17

Verdict: ACCEPTED

input
10 20
00000001100001000100
00000100000010000001
00000100000010000010
10000010000000100000
...

correct output
5

user output
5

Test 18

Verdict: ACCEPTED

input
20 10
0100001000
0100000000
0000010001
0000101000
...

correct output
4

user output
4

Test 19

Verdict: ACCEPTED

input
10 20
00100010000100000000
00000000000000000000
00100000000000000000
00000001000000000010
...

correct output
0

user output
0

Test 20

Verdict: ACCEPTED

input
20 10
0000010000
0000000000
1000000000
0000000000
...

correct output
0

user output
0

Test 21

Verdict: ACCEPTED

input
10 20
00000000000000000000
00000000000000000000
00000000000000000000
00000000000000000000
...

correct output
0

user output
0

Test 22

Verdict: ACCEPTED

input
20 10
0000000000
0000000000
0000000000
0000000000
...

correct output
0

user output
0

Test 23

Verdict: ACCEPTED

input
3000 3000
111111111111111111111111111111...

correct output
19444691141193

user output
19444691141193

Test 24

Verdict: ACCEPTED

input
3000 3000
001011111110111101100001111011...

correct output
6150476374242

user output
6150476374242

Test 25

Verdict: ACCEPTED

input
3000 3000
001011000111011110110111111110...

correct output
1213493895016

user output
1213493895016

Test 26

Verdict: ACCEPTED

input
3000 3000
000000001001000010110001000001...

correct output
75998707871

user output
75998707871

Test 27

Verdict: ACCEPTED

input
3000 3000
000000000000000000000000000000...

correct output
0

user output
0