Task: | Grid |
Sender: | Kanadan virallinen maajoukkue |
Submission time: | 2017-05-27 13:09:40 +0300 |
Language: | C++ |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.05 s | details |
#2 | ACCEPTED | 0.06 s | details |
#3 | ACCEPTED | 0.05 s | details |
#4 | ACCEPTED | 0.04 s | details |
#5 | ACCEPTED | 0.06 s | details |
#6 | ACCEPTED | 0.04 s | details |
#7 | ACCEPTED | 0.04 s | details |
#8 | ACCEPTED | 0.04 s | details |
#9 | ACCEPTED | 0.04 s | details |
#10 | ACCEPTED | 0.04 s | details |
#11 | ACCEPTED | 0.05 s | details |
#12 | ACCEPTED | 0.04 s | details |
#13 | ACCEPTED | 0.06 s | details |
#14 | ACCEPTED | 0.07 s | details |
#15 | ACCEPTED | 0.02 s | details |
#16 | ACCEPTED | 0.06 s | details |
#17 | ACCEPTED | 0.04 s | details |
#18 | ACCEPTED | 0.05 s | details |
#19 | ACCEPTED | 0.04 s | details |
#20 | ACCEPTED | 0.04 s | details |
#21 | ACCEPTED | 0.05 s | details |
#22 | ACCEPTED | 0.06 s | details |
#23 | TIME LIMIT EXCEEDED | -- | details |
#24 | TIME LIMIT EXCEEDED | -- | details |
#25 | TIME LIMIT EXCEEDED | -- | details |
#26 | TIME LIMIT EXCEEDED | -- | details |
#27 | TIME LIMIT EXCEEDED | -- | details |
Compiler report
input/code.cpp: In function 'int get(std::string, int)': input/code.cpp:9:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if(idx>=s.length()) ^
Code
#include<iostream> #include<queue> #include<stack> using namespace std; unsigned int mem[3000][100]; inline int get(string s, int idx){ if(idx>=s.length()) return 0; return (s[idx]=='1'); } //JOS TÄÄ MENEE LÄPI NÄIN NIIN VIHAAN ERITTÄIN PALJON // EN MUUTEN SAA 64-bit popcount toimimaa ;_____; int main(){ //cout<<__builtin_popcount(4)<<endl; int n,m; cin>>n>>m; for(int i=0; i<n; i++){ string s; cin>>s; for(int j=0; j<100; j++){ long long luku = 0; for(int k=0; k<32; k++){ luku = 2*luku + get(s, 32*j + k); } mem[i][j] = luku; } } long long ret = 0; for(int i=0; i<n; i++){ for(int j=0; j<i; j++){ long long cnt = 0; for(int k=0; k<50; k++){ cnt += __builtin_popcount(mem[i][k]&mem[j][k]); } ret += (cnt*(cnt-1))/2; } } cout<<ret<<endl; return 0; }
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: TIME LIMIT EXCEEDED
input |
---|
3000 3000 111111111111111111111111111111... |
correct output |
---|
19444691141193 |
user output |
---|
(empty) |
Test 24
Verdict: TIME LIMIT EXCEEDED
input |
---|
3000 3000 001011111110111101100001111011... |
correct output |
---|
6150476374242 |
user output |
---|
(empty) |
Test 25
Verdict: TIME LIMIT EXCEEDED
input |
---|
3000 3000 001011000111011110110111111110... |
correct output |
---|
1213493895016 |
user output |
---|
(empty) |
Test 26
Verdict: TIME LIMIT EXCEEDED
input |
---|
3000 3000 000000001001000010110001000001... |
correct output |
---|
75998707871 |
user output |
---|
(empty) |
Test 27
Verdict: TIME LIMIT EXCEEDED
input |
---|
3000 3000 000000000000000000000000000000... |
correct output |
---|
0 |
user output |
---|
(empty) |