QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#338838#4218. Hidden GraphJohnVictor36WA 1ms3880kbC++141.2kb2024-02-26 13:14:492024-02-26 13:14:51

Judging History

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

  • [2024-02-26 13:14:51]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3880kb
  • [2024-02-26 13:14:49]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
const int mod=998244353;
typedef long long ll;
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second

void add(int &x,int y){x=(x+y>=mod)?(x+y-mod):x+y;}
int qpow(int x,int y){int ret=1;while(y){if(y&1)ret=1ll*ret*x%mod;x=1ll*x*x%mod;y>>=1;}return ret;}
const int N=2005;
int n,k,col[N],cnt,vis[N];
vector<int>f[N],e[N];//f[i] is a independent set

int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	cin>>n;k=1;
	rep(i,1,n)f[1].pb(i),col[i]=1;
	while(1){
		printf("? %d ",f[k].size());
		for(auto x:f[k])printf("%d ",x);puts("");fflush(stdout);
		int i,j;cin>>i>>j;
		if(i==-1&&j==-1){
			for(auto x:f[k])++cnt;k++;
			if(cnt==n)break;
		} 
		else{
			e[i].pb(j);
			e[j].pb(i);
			rep(t,1,n){
				memset(vis,0,sizeof(vis));
				if(col[t]<k)continue;
				for(auto u:e[t])if(u<t){
					vis[col[u]]=1;
				}
				int col=k;while(vis[col])col++;
				::col[t]=col; 
			}
			rep(t,k,n)f[t].clear();
			rep(t,1,n)if(col[t]>=k)f[col[t]].pb(t);
		}
		//printf("Current coloring:\n");
		//rep(i,1,n){
		//	for(auto x:f[i])printf("%d ",x);puts("");
		//}
	}
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3880kb

input:

3
1 3
1 2
-1 -1
2 3
-1 -1
-1 -1

output:

? 3 1 2 3 
? 2 1 2 
? 1 1 
? 2 2 3 
? 1 2 
? 1 3 

result:

wrong answer format  Unexpected end of file - token expected