QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#774100#9783. Duloc Networkucup-team5319#Compile Error//C++142.3kb2024-11-23 11:47:552024-11-23 11:47:55

Judging History

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

  • [2024-11-23 11:47:55]
  • 评测
  • [2024-11-23 11:47:55]
  • 提交

answer

//Linkwish's code
#include<bits/stdc++.h>
//#define endl '\n'
#define si inline
#define fi first
#define se second
using namespace std;
typedef long long ll;typedef __int128 li;typedef long double ld;
typedef pair<int,int> pii;typedef pair<ll,ll> pll;
typedef const int ci;typedef const ll cl;ci iinf=INT_MAX;cl linf=LLONG_MAX;
template<typename T>si bool gmax(T &x,const T y){if(x<y)return x=y,1;return 0;}
template<typename T>si bool gmin(T &x,const T y){if(y<x)return x=y,1;return 0;}

namespace LinkWish{
	
	ci N=505;

	int n;

	int bl[N];
	vector<int> p[N];
	int d[N];

	si int ask(vector<int> x){
		tms++;
		if(tms>3499){
			cout<<"! 0"<<endl;
			exit(0);
		}
		vector<int> s(n,0);
		for(int i:x)s[i-1]=1;
		cout<<"? ";
		for(int i:s)cout<<i;
		cout<<endl;
		int res;cin>>res;
		return res;
	}

	int tms;
	si int ask(int x,int y){
		vector<int> que=p[x];
		for(int i:p[y])que.push_back(i);
		return ask(que);
	}

	si void merge(int x,int y){for(int i:p[y])p[x].push_back(i),bl[i]=x;}

	void mian(){
		cin>>n;

		priority_queue<pii> q;
		for(int i=1;i<=n;i++){
			d[i]=ask(vector<int>{i}),bl[i]=i,p[i].push_back(i);
			q.emplace(d[i],i);
		}

		static bool vis[N];
		for(;!q.empty();){
			int id=q.top().se,nv=q.top().fi;
			q.pop();

			if(nv!=d[id]||bl[id]!=id)continue;
			memset(vis,0,sizeof vis);
			for(int i=1;i<=n;i++){
				if(!vis[bl[i]]&&bl[i]!=id){
					int x=bl[i];
					vis[x]=true;
					int v=ask(id,x);
					if(v!=d[id]+d[x])merge(id,x),d[id]=v;
				}
			}
			if(d[id]==0){
				if((int)p[id].size()!=n)cout<<"! 0"<<endl;
				else cout<<"! 1"<<endl;
				return ;
			}
			memset(vis,0,sizeof vis);
			for(int i=n;i;i--){
				if(!vis[bl[i]]&&bl[i]!=id){
					int x=bl[i];
					vis[x]=true;
					int v=ask(id,x);
					if(v!=d[id]+d[x])merge(id,x),d[id]=v;
				}				
			}
			if(d[id]==0){
				if((int)p[id].size()!=n)cout<<"! 0"<<endl;
				else cout<<"! 1"<<endl;
				return ;
			}
			q.emplace(d[id],id);
		}
		cout<<"! 1"<<endl;
	}
}

signed main(){
	//#ifndef ONLINE_JUDGE
	//assert(freopen("in.in","r",stdin));
	//assert(freopen("out.out","w",stdout));
	//#endif
	//ios::sync_with_stdio(0);
	//cin.tie(0),cout.tie(0);
	LinkWish::mian();
	//cerr<<"DONEIN "<<LinkWish::tms<<endl;
	return 0;
}

詳細信息

answer.code: In function ‘int LinkWish::ask(std::vector<int>)’:
answer.code:25:17: error: ‘tms’ was not declared in this scope; did you mean ‘tm’?
   25 |                 tms++;
      |                 ^~~
      |                 tm