QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#116014 | #2043. Make a Sequence | NYCU_gAwr_gurA# | 100 ✓ | 13ms | 3384kb | C++17 | 1.6kb | 2023-06-27 21:56:51 | 2023-06-27 21:56:55 |
Judging History
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