QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#126516 | #6668. Trokuti | angry_face | 0 | 0ms | 3572kb | C++14 | 3.1kb | 2023-07-18 15:51:06 | 2023-07-18 15:51:09 |
Judging History
answer
# include <iostream>
# include <cstdio>
# include <vector>
# include <ctime>
# include <algorithm>
using namespace std ;
int n = 100 , a[205][205] , num[205][205] ;
int p[205] , st[205] ;
int cnt , x1 , x2 , x3 , cntq , q[205] ;
int ans ;
vector < int > vec ;
int query( int x , int y , int z )
{
cnt++ ;
printf("? %d %d %d\n" , x , y , z) ;
fflush( stdout ) ;
int t ;
scanf("%d" , &t) ;
return t ;
}
int solve(int u,int v,int w)
{
x1 = ( u - v + w ) / 2 ;
x2 = v - x1 ;
x3 = w - x1 ;
}
int main()
{
// for ( int i = 1 ; i <= n ; i++ )
// for ( int j = i + 1 ; j <= n ; j++ ) a[i][j] = a[j][i] = rand() % 2 ;
for ( int i = 1 ; i <= 6 ; i++ )
for ( int j = i + 1 ; j <= 6 ; j++ )
for ( int k = j + 1 ; k <= 6 ; k++ )
{
if ( vec.size() ) continue ;
ans = query( p[i] , p[j] , p[k] ) ;
if ( ! ans )
{
vec.push_back( p[i] ) , vec.push_back( p[j] ) , vec.push_back( p[k] ) ;
st[p[i]] = st[p[j]] = st[p[k]] = 1;
}
else if ( ans == 3 )
{
vec.push_back( p[i] ) , vec.push_back( p[j] ) , vec.push_back( p[k] ) ;
st[p[i]] = st[p[j]] = st[p[k]] = 1;
num[p[i]][p[j]] = num[p[j]][p[i]] = num[p[i]][p[k]] = num[p[k]][p[i]] = num[p[j]][p[k]] = num[p[k]][p[j]] = 1 ;
}
}
for ( int i = 1 ; i <= n ; i++ )
{
if ( st[p[i]] ) continue ;
cntq =0 ;
for ( auto j : vec ) q[++ cntq] = j ;
int tmp = 1 ;
while ( tmp + 2 <= cntq )
{
int ansb = query( p[i] , q[tmp] , q[tmp + 1] ) - num[q[tmp]][q[tmp + 1]] ;
if ( ansb == 0 || ansb == 2 )
{
num[p[i]][q[tmp]] = num[q[tmp]][p[i]] = num[p[i]][q[tmp + 1]] = num[q[tmp + 1]][p[i]] = ansb / 2 ;
tmp += 2 ;
continue ;
}
int nbc = query( p[i] , q[tmp + 1] , q[tmp + 2] ) - num[q[tmp + 1]][q[tmp + 2]] ;
if ( nbc == 0 || nbc == 2 )
{
num[p[i]][q[tmp + 1]] = num[q[tmp + 1]][p[i]] = num[p[i]][q[tmp + 2]] = num[q[tmp + 2]][p[i]] = nbc / 2 ;
num[p[i]][q[tmp]] = num[q[tmp]][p[i]] = ansb - num[p[i]][q[tmp + 1]] ;
tmp += 3 ;
continue ;
}
int ansc = query( p[i] , q[tmp] , q[tmp + 2] ) - num[q[tmp]][q[tmp + 2]] ;
solve( ansb , nbc , ansc ) ;
num[p[i]][q[tmp]] = num[q[tmp]][p[i]] = x1 ;
num[p[i]][q[tmp + 1]] = num[q[tmp + 1]][p[i]] = x2 ;
num[p[i]][q[tmp + 2]] = num[q[tmp + 2]][p[i]] = x3 ;
tmp += 3 ;
}
if ( tmp <= cntq )
{
num[p[i]][q[tmp]] = num[q[tmp]][p[i]] = query( p[i] , q[tmp - 1] , q[tmp] ) - num[p[i]][q[tmp - 1]] - num[q[tmp - 1]][q[tmp]] ;
}
if ( tmp + 1 <= cntq )
{
num[p[i]][q[tmp + 1]] = num[q[tmp + 1]][p[i]] = query( p[i] , q[tmp - 1] , q[tmp + 1] ) - num[p[i]][q[tmp - 1]] - num[q[tmp - 1]][q[tmp + 1]] ;
}
vec.push_back( p[i] ) ;
st[p[i]] = true ;
}
// for ( int i = 1 ; i <= n ; i++ )
// for ( int j = i + 1 ; j <= n ; j++ )
// {
// if ( num[i][j] != a[i][j] )
// {
// printf("GG:%d %d\n" , i , j) ;
// }
// }
puts("!") ;
for ( int i = 1 ; i <= n ; i++ )
{
for ( int j = 1 ; j <= n ; j++ ) printf("%d" , num[i][j]) ;
puts("") ;
}
fflush( stdout ) ;
return 0 ;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3572kb
input:
output:
? 0 0 0
result:
wrong answer Integer parameter [name=x] equals to 0, violates the range [1, 100]