QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#116014#2043. Make a SequenceNYCU_gAwr_gurA#100 ✓13ms3384kbC++171.6kb2023-06-27 21:56:512023-06-27 21:56:55

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-27 21:56:55]
  • 评测
  • 测评结果:100
  • 用时:13ms
  • 内存:3384kb
  • [2023-06-27 21:56:51]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define endl '\n'

signed main() {

    int n,m,p;
    while((cin>>n>>m>>p) && n)
    {
        int arr[15][15][15]={}, nene[15][15]={};
        int a,b,c,ans,aoi;
        ans=aoi=0;
        int j,x,y,z;
        for(int i=0;i<p;i++)
        {
            cin>>a>>b;
            c=++nene[a][b];
            //cout<<"   "<<i%2+1<<' '<<a<<' '<<b<<' '<<c<<endl;
            
            arr[a][b][c]=i%2+1;

            for(x=-1;x<=1;x++)
            {
                for(y=-1;y<=1;y++){
                    for(z=-1;z<=1;z++)
                    {
                        if(!x && !y && !z)
                            continue;
                        for(j=0;;j++)
                        {
                            //cout<<"ouooououuuou "<<j<<endl;
                            if(arr[a+j*x][b+j*y][c+j*z]!=arr[a+j*x+x][b+j*y+y][c+j*z+z])
                                break;
                            //cout<<"# "<<j<<endl;
                        }
                        int o,oo;
                        o=j;
                        for(j=0;;j++)
                        {
                            if(arr[a-j*x][b-j*y][c-j*z]!=arr[a-j*x-x][b-j*y-y][c-j*z-z])
                                break;
                        }
                        oo=j;
                        if(o+oo+1>=m && !ans)
                            ans=i%2+1, aoi=i+1;
                    }
                }
            }
        }
        if(ans==1)
            cout<<"Black"<<' '<<aoi<<endl;
        else if(ans==2)
            cout<<"White "<<aoi<<endl;
        else
            cout<<"Draw"<<endl;
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 13ms
memory: 3384kb

input:

3 3 3
1 1
1 1
1 1
3 3 14
1 1
2 2
3 2
3 1
1 3
1 2
1 3
1 3
2 3
3 3
1 2
1 1
3 1
3 1
3 3 5
1 1
1 3
2 1
2 3
3 1
3 3 5
1 1
3 1
1 2
3 2
1 3
3 3 5
1 1
2 2
1 1
2 2
1 1
3 3 5
1 1
3 1
2 2
3 2
3 3
3 3 5
3 1
1 1
2 2
1 2
1 3
3 3 7
1 1
2 1
2 1
3 1
1 1
3 1
3 1
3 3 7
3 1
2 1
2 1
1 1
3 1
1 1
1 1
3 3 7
1 1
1 2
1 2
1 3...

output:

Draw
Draw
Black 5
Black 5
Black 5
Black 5
Black 5
Black 7
Black 7
Black 7
Black 7
Black 7
Black 7
Black 7
Black 7
Black 7
Black 7
Black 7
Black 7
Black 11
Black 11
Black 11
Black 11
Black 11
Black 11
Black 11
Black 11
Black 11
Black 11
Black 13
Black 13
White 8
Black 11
Black 7
White 22
White 10
Bla...

result:

ok 166 lines