QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#126517#6668. Trokutiangry_face0 8ms3860kbC++143.1kb2023-07-18 15:51:382023-07-18 15:51:40

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:51:40]
  • 评测
  • 测评结果:0
  • 用时:8ms
  • 内存:3860kb
  • [2023-07-18 15:51:38]
  • 提交

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 <= n ; i++ ) p[i] = i ;
	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
Time Limit Exceeded

Test #1:

score: 100
Accepted
time: 3ms
memory: 3860kb

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:

? 1 2 3
? 4 1 2
? 4 2 3
? 5 1 2
? 5 2 3
? 5 2 4
? 6 1 2
? 6 3 4
? 6 4 5
? 7 1 2
? 7 3 4
? 7 4 5
? 7 4 6
? 8 1 2
? 8 3 4
? 8 5 6
? 8 6 7
? 9 1 2
? 9 3 4
? 9 5 6
? 9 6 7
? 9 6 8
? 10 1 2
? 10 3 4
? 10 5 6
? 10 7 8
? 10 8 9
? 11 1 2
? 11 3 4
? 11 5 6
? 11 7 8
? 11 8 9
? 11 8 10
? 12 1 2
? 12 3 4
? 12 5...

result:

points 1.0 points  1.0 correct 2547 queries

Test #2:

score: 100
Accepted
time: 8ms
memory: 3632kb

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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 1 2
? 9 3 4
? 9 5 6
? 9 6 7
? 9 6 8
? 10 1 2
? 10 3 4
? 10 5 6
? 10 7 8
? 10 8 9
? 11 1 2
? 11 3 4
? 11 5 6
? 11 7 8
? 11 8 9
? 11 8 10
? 12 1 2
? 12 3 4
? 12 5...

result:

points 1.0 points  1.0 correct 2548 queries

Test #4:

score: 0
Time Limit Exceeded

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:

? 1 2 3
? 4 1 2
? 4 2 3
? 5 1 2
? 5 2 3
? 5 2 4
? 6 1 2
? 6 3 4
? 6 4 5
? 7 1 2
? 7 3 4
? 7 4 5
? 7 4 6
? 8 1 2
? 8 3 4
? 8 5 6
? 8 6 7
? 9 1 2
? 9 3 4
? 9 5 6
? 9 6 7
? 9 6 8
? 10 1 2
? 10 3 4
? 10 5 6
? 10 7 8
? 10 8 9
? 11 1 2
? 11 3 4
? 11 5 6
? 11 7 8
? 11 8 9
? 11 8 10
? 12 1 2
? 12 3 4
? 12 5...

result: