QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#108754#6506. Chase Game 3ckiseki#Compile Error//C++141.9kb2023-05-26 16:21:032023-05-26 16:21:04

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-26 16:21:04]
  • 评测
  • [2023-05-26 16:21:03]
  • 提交

answer

#include <bits/stdc++.h>
#ifdef CKISEKI
#define safe cerr<<__PRETTY_FUNCTION__\
    <<" line "<<__LINE__<<" safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
using std::cerr;
template <typename ...T>
void debug_(const char *s, T ...a) {
    cerr << "\e[1;32m(" << s << ") = (";
    int cnt = sizeof...(T);
    (..., (cerr << a << (--cnt ? ", " : ")\e[0m\n")));
}
template <typename I>
void orange_(const char *s, I L, I R) {
    cerr << "\e[1;32m[ " << s << " ] = [ ";
    for (int f = 0; L != R; ++L)
        cerr << (f++ ? ", " : "") << *L;
    cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) ((void)0)
#define orange(...) ((void)0)
#endif

using namespace std;

signed main() {
    cin.tie(nullptr) -> sync_with_stdio(false);
    int T;
    cin >> T;
    while (T--) {
        int n;
        cin >> n;
        vector<int> p(n);
        for (int i = 0; i < n; i++)
            cin >> p[i];

        vector<tuple<int,int,int>> v;
        for (int i = 2; i < n; i++) {
            int a[3] = {
                p[i - 2],
                p[i - 1],
                p[i - 0],
            };
            sort(a, a+3);
            v.emplace_back(a[0], a[1], a[2]);
        }
        sort(v.begin(), v.end());
        bool ok = true;
        for (int i = 1; i <= n-2; i++) {
            if (v[i-1] != tuple{i, i+1, i+2}) {
                ok = false;
            }
        }
        if (ok) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }

        // if ((p[0] == 1 && p[n-1] == n) || (p[0] == n && p[n-1] == 1)) {
        //     bool ok = true;
        //     for (int i = 1; i < n; i++) {
        //         if (abs(p[i] - p[i - 1]) > 2)
        //             ok = false;
        //     }

        //     if (ok) {
        //         cout << "Yes\n";
        //     } else {
        //         cout << "No\n";
        //     }
        // } else {
        //     cout << "No\n";
        // }
    }
}

详细

answer.code: In function ‘int main()’:
answer.code:53:32: error: missing template arguments before ‘{’ token
   53 |             if (v[i-1] != tuple{i, i+1, i+2}) {
      |                                ^
answer.code:53:32: error: expected ‘)’ before ‘{’ token
   53 |             if (v[i-1] != tuple{i, i+1, i+2}) {
      |                ~               ^
      |                                )