QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#245436#7514. Clique ChallengeDaiRuiChen007Compile Error//C++141003b2023-11-09 21:57:132023-11-09 21:57:14

Judging History

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

  • [2023-11-09 21:57:14]
  • 评测
  • [2023-11-09 21:57:13]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MOD=1e9+7;
int n,m,d[1005],q[1005],dp[1<<22],lo[1<<22],ans;
bool g[1005][1005];
ll ne[1005],f[1<<22];
signed main() {
	scanf("%d%d",&n,&m);
	for(int i=1;i<(1<<21);++i) lo[i<<1]=lo[i]+1;
	for(int i=1,u,v;i<=m;++i) scanf("%d%d",&u,&v),g[u][v]=g[v][u]=true,++d[u],++d[v];
	for(int i=1;i<=n;++i) g[i][i]=true;
	for(int u=1;u<=n;++u) {
		int k=0;
		for(int j=1;j<=n;++j) if(g[u][j]&&(d[j]>d[u]||(d[j]==d[u]&&j>u)) q[k++]=j;
		fill(ne,ne+k,0);
		for(int i=0;i<k;++i) for(int j=0;j<k;++j) if(!g[q[i]][q[j]]) ne[i]|=1ll<<j;
		memset(dp,0,sizeof(dp));
		int L=(1<<(k/2))-1;
		for(int s=0;s<=L;++s) {
			if(s) f[s]=f[s^(1<<lo[s])]|ne[lo[s]];
			dp[s]=!(s&f[s]);
		}
		for(int d=1;d<=L;d<<=1) for(int i=0;i<=L;++i) if(i&d) dp[i]+=dp[i^d];
		for(int s=0;s<(1<<(k-k/2));++s) {
			if(s) f[s]=f[s^(1<<lo[s])]|ne[lo[s]+k/2];
			if(!(s&f[s])) ans=(ans+dp[L^(f[s]&L)])%MOD;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:15:42: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’
   15 |                 for(int j=1;j<=n;++j) if(g[u][j]&&(d[j]>d[u]||(d[j]==d[u]&&j>u)) q[k++]=j;
      |                                          ^
answer.code:15:81: error: expected ‘;’ before ‘q’
   15 |                 for(int j=1;j<=n;++j) if(g[u][j]&&(d[j]>d[u]||(d[j]==d[u]&&j>u)) q[k++]=j;
      |                                                                                 ^~
      |                                                                                 ;
answer.code:16:32: error: expected ‘)’ before ‘;’ token
   16 |                 fill(ne,ne+k,0);
      |                                ^
      |                                )
answer.code:15:41: note: to match this ‘(’
   15 |                 for(int j=1;j<=n;++j) if(g[u][j]&&(d[j]>d[u]||(d[j]==d[u]&&j>u)) q[k++]=j;
      |                                         ^
answer.code:16:21: error: could not convert ‘std::fill<long long int*, int>(((long long int*)(& ne)), (((long long int*)(& ne)) + ((sizetype)(((long unsigned int)k) * 8))), 0)’ from ‘void’ to ‘bool’
   16 |                 fill(ne,ne+k,0);
      |                 ~~~~^~~~~~~~~~~
      |                     |
      |                     void
answer.code:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d%d",&n,&m);
      |         ~~~~~^~~~~~~~~~~~~~
answer.code:11:40: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         for(int i=1,u,v;i<=m;++i) scanf("%d%d",&u,&v),g[u][v]=g[v][u]=true,++d[u],++d[v];
      |                                   ~~~~~^~~~~~~~~~~~~~