QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#130166#6376. LaLa and LampkkioWA 1ms3780kbC++141.0kb2023-07-23 17:24:132023-07-23 17:24:15

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-23 17:24:15]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3780kb
  • [2023-07-23 17:24:13]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int maxn=2005;
int a[maxn],b[maxn],c[maxn],s[maxn][maxn],n;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=i;j++)
            scanf("%1d",&s[i][j]);
    for(a[n]=0;a[n]<=1;a[n]++)
        for(a[n-1]=0;a[n-1]<=1;a[n-1]++)
            for(b[1]=0;b[1]<=1;b[1]++)
            {
                c[1]=s[n][1]^a[n]^b[1];
                for(int i=2;i<=n;i++)
                    c[i]=s[n-1][i-1]^b[i-1]^a[n-1],b[i]=a[n]^c[i]^s[n][i];
                bool ok=1;
                for(int i=n-3;i>=1;i--)
                {
                    int flag=0;
                    for(int j=1;j<=n;j++)
                    {
                        int v=s[n][j]^c[j]^b[j];
                        if(v)flag|=2;
                        else flag|=1;
                    }
                    if(flag==3){ok=0;break;}
                }
                if(ok){puts("Yes");return 0;}
            }
    puts("No");
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6
0
00
000
0110
00100
000000

output:

Yes

result:

ok answer is YES

Test #2:

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

input:

2
0
11

output:

Yes

result:

ok answer is YES

Test #3:

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

input:

3
1
10
011

output:

Yes

result:

ok answer is YES

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 3604kb

input:

4
1
11
101
0101

output:

Yes

result:

wrong answer expected NO, found YES