QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#89341#5251. ConstellationsmolarsuCompile Error//C++201.6kb2023-03-19 20:20:432023-03-19 20:20:44

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-19 20:20:44]
  • 评测
  • [2023-03-19 20:20:43]
  • 提交

answer

#include<bits/stdc++.h>
#define ri register int
#define fu(i, a, b) for(ri i = (a), ed = (b); i <= ed; ++i)
#define fd(i, a, b) for(ri i = (a), ed = (b); i >= ed; --i)
using namespace std;
#define int long long
const int N = 5e3 + 5;
const int INF = 0x3f3f3f3f3f3f3f3f;
int read() {
	int f = 1, x = 0; char ch = getchar();
	while (ch > '9' || ch < '0') { if (ch == '-')f = -1; ch = getchar(); }
	while (ch <= '9' && ch >= '0') { x = (x << 1) + (x << 3) + (ch ^ 48);  ch = getchar(); }
	return x * f;
}

int dis[N][N];
struct Node {
	int x, y, rk, sz;
}a[N];
bool vis[N];

signed main() {
	int n = read();
	vector<int> vec;
	fu(i, 1, n) a[i].x = read(), a[i].y = read(), a[i].rk = i, a[i].sz = 1, vec.push_back(i);
	memset(dis, 0x3f, sizeof dis);
	fu(i, 1, n) fu(j, 1, n) dis[i][j] = (a[i].x - a[j].x) * (a[i].x - a[j].x) + (a[i].y - a[j].y) * (a[i].y - a[j].y);
	int tot = n;
	fd(_, n - 1, 1) {
		int x = 0, y = 0;
		double mi = INF;
		fu(i, 0, int (vec.size()) - 1) {
			int u = a[vec[i]].rk;
			fu(j, i + 1, int (vec.size()) - 1) {
				int v = a[vec[j]].rk;
				if (1.0 * dis[u][v] / a[u].sz / a[v].sz < mi) x = i, y = j, mi = dis[u][v] / a[u].sz / a[v].sz;
			}
		}
		//cout << x << ' ' << y << endl;
		tot++;
		int u = vec[x], v = vec[y];
		a[tot].sz = a[u].sz + a[v].sz;
		a[tot].rk = tot;
		
		vec.erase(vec.begin() + y);
		vec.erase(vec.begin() + x);
		fu(i, 0, int (vec.size()) - 1) {
			int now = a[vec[i]].rk;
			dis[now][tot] = dis[tot][now] = dis[now][u] + dis[now][v];
		}
		
		vec.push_back(tot);
		printf("%lld\n", a[tot].sz);

	}
	return 0;
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:25:12: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   25 |         fu(i, 1, n) a[i].x = read(), a[i].y = read(), a[i].rk = i, a[i].sz = 1, vec.push_back(i);
      |            ^
answer.code:3:28: note: in definition of macro ‘fu’
    3 | #define fu(i, a, b) for(ri i = (a), ed = (b); i <= ed; ++i)
      |                            ^
answer.code:3:37: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
    3 | #define fu(i, a, b) for(ri i = (a), ed = (b); i <= ed; ++i)
      |                                     ^~
answer.code:25:9: note: in expansion of macro ‘fu’
   25 |         fu(i, 1, n) a[i].x = read(), a[i].y = read(), a[i].rk = i, a[i].sz = 1, vec.push_back(i);
      |         ^~
answer.code:27:12: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   27 |         fu(i, 1, n) fu(j, 1, n) dis[i][j] = (a[i].x - a[j].x) * (a[i].x - a[j].x) + (a[i].y - a[j].y) * (a[i].y - a[j].y);
      |            ^
answer.code:3:28: note: in definition of macro ‘fu’
    3 | #define fu(i, a, b) for(ri i = (a), ed = (b); i <= ed; ++i)
      |                            ^
answer.code:3:37: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
    3 | #define fu(i, a, b) for(ri i = (a), ed = (b); i <= ed; ++i)
      |                                     ^~
answer.code:27:9: note: in expansion of macro ‘fu’
   27 |         fu(i, 1, n) fu(j, 1, n) dis[i][j] = (a[i].x - a[j].x) * (a[i].x - a[j].x) + (a[i].y - a[j].y) * (a[i].y - a[j].y);
      |         ^~
answer.code:27:24: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   27 |         fu(i, 1, n) fu(j, 1, n) dis[i][j] = (a[i].x - a[j].x) * (a[i].x - a[j].x) + (a[i].y - a[j].y) * (a[i].y - a[j].y);
      |                        ^
answer.code:3:28: note: in definition of macro ‘fu’
    3 | #define fu(i, a, b) for(ri i = (a), ed = (b); i <= ed; ++i)
      |                            ^
answer.code:3:37: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
    3 | #define fu(i, a, b) for(ri i = (a), ed = (b); i <= ed; ++i)
      |                                     ^~
answer.code:27:21: note: in expansion of macro ‘fu’
   27 |         fu(i, 1, n) fu(j, 1, n) dis[i][j] = (a[i].x - a[j].x) * (a[i].x - a[j].x) + (a[i].y - a[j].y) * (a[i].y - a[j].y);
      |                     ^~
answer.code:29:12: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   29 |         fd(_, n - 1, 1) {
      |            ^
answer.code:4:28: note: in definition of macro ‘fd’
    4 | #define fd(i, a, b) for(ri i = (a), ed = (b); i >= ed; --i)
      |                            ^
answer.code:4:37: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
    4 | #define fd(i, a, b) for(ri i = (a), ed = (b); i >= ed; --i)
      |                                     ^~
answer.code:29:9: note: in expansion of macro ‘fd’
   29 |         fd(_, n - 1, 1) {
      |         ^~
answer.code:32:20: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   32 |                 fu(i, 0, int (vec.size()) - 1) {
      |                    ^
answer.code:3:28: note: in definition of macro ‘fu’
    3 | #define fu(i, a, b) for(ri i = (a), ed = (b); i <= ed; ++i)
      |                            ^
answer.code:6:13: error: expected primary-expression before ‘long’
    6 | #define int long long
      |             ^~~~
answer.code:3:43: note: in definition of macro ‘fu’
    3 | #define fu(i, a, b) for(ri i = (a), ed = (b); i <= ed; ++i)
      |                                           ^
answer.code:32:26: note: in expansion of macro ‘int’
   32 |                 fu(i, 0, int (vec.size()) - 1) {
      |                          ^~~
answer.code:6:13: error: expected ‘)’ before ‘long’
    6 | #define int long long
      |             ^~~~
answer.code:3:43: note: in definition of macro ‘fu’
    3 | #define fu(i, a, b) for(ri i = (a), ed = (b); i <= ed; ++i)
      |                                           ^
answer.code:32:26: note: in expansion of macro ‘int’
   32 |                 fu(i, 0, int (vec.size()) - 1) {
      |                          ^~~
answer.code:3:42: note: to match this ‘(’
    3 | #define fu(i, a, b) for(ri i = (a), ed = (b); i <= ed; ++i)
      |                                          ^
answer.code:32:17: note: in expansion of macro ‘fu’
   32 |                 fu(i, 0, int (vec.size()) - 1) {
      |                 ^~
answer.code:3:37: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
    3 | #define fu(i, a, b) for(ri i = (a), ed = (b); i <= ed; ++i)
      |                                     ^~
answer.code:32:17: note: in expansion of macro ‘fu’
   32 |                 fu(i, 0, int (vec.size()) - 1) {
      |                 ^~
answer.code:34:28...