QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#126514#6668. Trokutiangry_face0 5ms3940kbC++143.2kb2023-07-18 15:50:052023-07-18 15:50:08

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-18 15:50:08]
  • 评测
  • 测评结果:0
  • 用时:5ms
  • 内存:3940kb
  • [2023-07-18 15:50:05]
  • 提交

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()
{
	srand( time( 0 ) ) ; 
//	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 <= n ; i++ ) p[i] = i ;
	random_shuffle( p + 1 , p + n + 1 ) ;
	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 ;
		random_shuffle( q + 1 , q + cntq + 1 ) ;
		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
Dangerous Syscalls

Test #1:

score: 100
Accepted
time: 5ms
memory: 3768kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 89 84 65
? 67 65 84
? 67 84 89
? 91 89 65
? 91 65 84
? 91 65 67
? 23 67 65
? 23 89 84
? 23 84 91
? 82 67 91
? 82 65 84
? 82 84 23
? 82 84 89
? 85 89 23
? 85 67 84
? 85 82 65
? 85 65 91
? 58 89 91
? 58 23 65
? 58 67 85
? 58 85 84
? 58 85 82
? 57 82 89
? 57 85 65
? 57 23 67
? 57 58 91
? 57 91 84
? 2...

result:

points 1.0 points  1.0 correct 2547 queries

Test #2:

score: 100
Accepted
time: 4ms
memory: 3940kb

input:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

output:

? 89 84 65
? 67 65 84
? 67 84 89
? 91 89 65
? 91 65 84
? 91 65 67
? 23 67 65
? 23 89 84
? 23 84 91
? 82 67 91
? 82 65 84
? 82 84 23
? 82 84 89
? 85 89 23
? 85 67 84
? 85 82 65
? 85 65 91
? 58 89 91
? 58 23 65
? 58 67 85
? 58 85 84
? 58 85 82
? 57 82 89
? 57 85 65
? 57 23 67
? 57 58 91
? 57 91 84
? 2...

result:

points 1.0 points  1.0 correct 2547 queries

Test #3:

score: 0
Dangerous Syscalls

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 29 15 98
? 20 98 29
? 20 29 15
? 36 20 98
? 36 98 29
? 36 98 15
? 90 36 15
? 90 20 98
? 90 98 29
? 65 29 15
? 65 36 20
? 65 20 98
? 65 20 90
? 74 65 29
? 74 15 90
? 74 20 36
? 74 36 98
? 18 36 65
? 18 90 29
? 18 15 98
? 18 98 20
? 18 98 74
? 8 15 90
? 8 98 36
? 8 74 20
? 8 18 29
? 8 29 65
? 37 20 ...

result: