QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#647790#5407. 基础图论练习题PatrickStarCompile Error//C++141.2kb2024-10-17 15:41:422024-10-17 15:41:52

Judging History

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

  • [2024-10-17 15:41:52]
  • 评测
  • [2024-10-17 15:41:42]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mod = 1e9+7;
int t, n, sum[5005];
bool book[5005][5005];
int deg[5005];
bool cmp(e x, e y) {
	return x.u<y.u;
}
int main() {
	scanf("%d", &t);
	for (int zqw=1;zqw<=t;zqw++) {
		scanf("%d", &n);
		for (int p=1;p<=n;p++) {
			for (int k=1;k<=n;k++) {
				book[p][k] = 0;
			}
		}
		for (int p=2;p<=n;p++) {
			for (int k=1;k<=(p+2)/4;k++) {
				char c;
				cin>>c;
				int u;
				if (c<='9') u = c-'0';
				else u = 10+c-'A';
				for (int i=0;i<=3;i++) {
					if ((u>>i)&1) book[p][4*k+i-3] = 1;
				}
			}
		}
		for (int p=1;p<=n;p++) {
			for (int k=1;k<p;k++) {
				if (!book[p][k]) book[k][p] = 1;
			}
		}
		for (int p=1;p<=n;p++) {
			deg[p] = 0;
			for (int k=1;k<=n;k++) {
				deg[p]+=book[p][k];
			}
		}
		ll ans = 0, o = 1;
		for (int i=1;i<=n;i++) {
			for (int j=1;j<i;j++) {
				if (book[i][j]) deg[i]--, deg[j]++;
				else deg[i]++, deg[i]--;
				int sum = 0, u = 0;
				for (int p=1;p<=n;p++) {
					sum+=deg[p];
					if (sum==p*(p-1)/2) u++;
				}
				if (book[i][j]) deg[i]++, deg[j]--;
				else deg[i]--, deg[i]++;
				ans = (ans+o*u)%mod;
				o = o*2%mod;
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}

详细

answer.code:8:10: error: ‘e’ was not declared in this scope
    8 | bool cmp(e x, e y) {
      |          ^
answer.code:8:15: error: ‘e’ was not declared in this scope
    8 | bool cmp(e x, e y) {
      |               ^
answer.code:8:18: error: expression list treated as compound expression in initializer [-fpermissive]
    8 | bool cmp(e x, e y) {
      |                  ^
answer.code: In function ‘int main()’:
answer.code:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d", &t);
      |         ~~~~~^~~~~~~~~~
answer.code:14:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |                 scanf("%d", &n);
      |                 ~~~~~^~~~~~~~~~