QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#656529#4236. Triangular LogschuchuCompile Error//C++201.7kb2024-10-19 13:16:162024-10-19 13:16:16

Judging History

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

  • [2024-10-19 13:16:16]
  • 评测
  • [2024-10-19 13:16:16]
  • 提交

answer

#pragma GCC optimize("Ofast,unroll-loops")

#include <bits/stdc++.h>
#pragma GCC target("avx,avx2,bmi,bmi2,lzcnt,popcnt,tune=native")
using namespace std;
typedef long long ll;

void solve() {
    int n, q; cin >> n >> q;
    int sz = (n + 7) / 8 * 8;
    array<int, 3> p[sz];
    for (int i = 0; i < n; ++i) {
        cin >> p[i][0] >> p[i][1] >> p[i][2];
    }
    for (int i = n; i < sz; ++i) p[i][0] = p[i][1] = p[i][2] = -1;
    sort(p, p+sz);

    for (int i = 0; i < q; ++i) {
        int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
        vector<unsigned> tmp[8];
        int ct[8] = {0};
        for (int j = 0; j < sz; j += 8) {
            if (x1 > p[j + 7][0]) continue;
            
            // Process pairs
            for (int k = 0; k < 16; ++k) {
                if (x1 <= p[j + k][0] && p[j + k][0] <= x2 && y1 <= p[j + k][1] && p[j + k][1] <= y2) {
                    tmp[k].push_back(p[j + k][2]);
                    ++ct[k];
                }
            }

            // Combined count check
            if (ct[0] + ct[1] + ct[2] + ct[3] + ct[4] + ct[5] + ct[6] + ct[7] > 60) { cout << "1\n"; continue; }
            for (int j = 1; j < 8; ++j) for (auto z : tmp[j]) tmp[0].push_back(z);
            sort(tmp[0].begin(), tmp[0].end());
            bool ok = 1;
            for (int j = 0; j < (int)(tmp[0].size()) - 2; ++j) {
                if (tmp[0][j] + tmp[0][j+1] > tmp[0][j+2]) {
                    cout << "1\n"; 
                    ok = 0;
                    break;
                }
            }
            if (ok) cout << "0\n";
        }
}

int main() {
    cin.tie(0);
    cin.sync_with_stdio(0);

	int t = 1;
    // cin >> t;
	while (t--) solve();
}

详细

answer.code: In function ‘void solve()’:
answer.code:49:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   49 | int main() {
      |         ^~
answer.code:49:9: note: remove parentheses to default-initialize a variable
   49 | int main() {
      |         ^~
      |         --
answer.code:49:9: note: or replace parentheses with braces to value-initialize a variable
answer.code:49:12: error: a function-definition is not allowed here before ‘{’ token
   49 | int main() {
      |            ^
answer.code:56:2: error: expected ‘}’ at end of input
   56 | }
      |  ^
answer.code:8:14: note: to match this ‘{’
    8 | void solve() {
      |              ^