QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#197395#6380. LaLa and Divination MagicZhou_JKWA 1ms7952kbC++231.4kb2023-10-02 15:23:352023-10-02 15:23:35

Judging History

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

  • [2023-10-02 15:23:35]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:7952kb
  • [2023-10-02 15:23:35]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<vector>
#include<bitset>
#include<tuple>
using namespace std;
const int N=2005;
int n,m;
int s[N][N];
bitset<N>a[N],b[N];
vector<tuple<int,int,int>>ans;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        string str;
        cin>>str;
        for(int j=1;j<=m;j++)
            s[i][j]=str[j-1]-'0';
        for(int j=1;j<=m;j++)
            a[j][i]=s[i][j],b[j][i]=s[i][j]^1;
    }
    for(int i=1;i<=m;i++)
    {
        if(a[i].count()==n)
        {
            ans.emplace_back(i,i,4);
        }
        if(b[i].count()==n)
        {
            ans.emplace_back(i,i,1);
        }
    }
    for(int i=1;i<=m;i++)
        for(int j=i+1;j<=m;j++)
        {
            if((a[i]|a[j]).count()==n)
            {
                ans.emplace_back(i,j,4);
            }
            if((b[i]|b[j]).count()==n)
            {
                ans.emplace_back(i,j,1);
            }
            if((a[i]|b[j]).count()==n)
            {
                ans.emplace_back(i,j,2);
            }
            if((b[i]|a[j]).count()==n)
            {
                ans.emplace_back(i,j,3);
            }
        }
    int k=ans.size();
    cout<<k<<"\n";
    for(auto [i,j,t]:ans)
        cout<<i-1<<" "<<j-1<<" "<<t<<"\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3580kb

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #2:

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

input:

3 3
101
011
111

output:

6
2 2 4
0 1 4
0 2 4
0 2 3
1 2 4
1 2 3

result:

ok Kout = 6, Kans = 6

Test #3:

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

input:

2 1
0
1

output:

0

result:

ok Kout = 0, Kans = 0

Test #4:

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

input:

2 1
0
1

output:

0

result:

ok Kout = 0, Kans = 0

Test #5:

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

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #6:

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

input:

2 1
0
1

output:

0

result:

ok Kout = 0, Kans = 0

Test #7:

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

input:

2 1
0
1

output:

0

result:

ok Kout = 0, Kans = 0

Test #8:

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

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #9:

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

input:

1 1
1

output:

1
0 0 4

result:

ok Kout = 1, Kans = 1

Test #10:

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

input:

1 1
0

output:

1
0 0 1

result:

ok Kout = 1, Kans = 1

Test #11:

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

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #12:

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

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #13:

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

input:

2 4
0111
0010

output:

15
0 0 1
2 2 4
0 1 1
0 1 3
0 2 4
0 2 1
0 2 3
0 3 1
0 3 3
1 2 4
1 2 3
1 3 2
1 3 3
2 3 4
2 3 2

result:

ok Kout = 15, Kans = 15

Test #14:

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

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #15:

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

input:

4 2
10
11
01
00

output:

0

result:

ok Kout = 0, Kans = 0

Test #16:

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

input:

2 1
1
0

output:

0

result:

ok Kout = 0, Kans = 0

Test #17:

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

input:

2 4
0010
1000

output:

15
1 1 1
3 3 1
0 1 1
0 1 2
0 2 4
0 2 1
0 3 1
0 3 2
1 2 1
1 2 3
1 3 1
1 3 2
1 3 3
2 3 1
2 3 2

result:

ok Kout = 15, Kans = 15

Test #18:

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

input:

2 5
11101
00000

output:

21
3 3 1
0 1 2
0 1 3
0 2 2
0 2 3
0 3 1
0 3 2
0 4 2
0 4 3
1 2 2
1 2 3
1 3 1
1 3 2
1 4 2
1 4 3
2 3 1
2 3 2
2 4 2
2 4 3
3 4 1
3 4 3

result:

ok Kout = 21, Kans = 21

Test #19:

score: -100
Wrong Answer
time: 0ms
memory: 3596kb

input:

5 4
0010
1001
0011
0101
1011

output:

5
0 1 1
0 3 3
1 2 1
1 3 3
2 3 4

result:

wrong answer The output contains more solutions than intended.