/ WOJ /

记录详情

Compile Error

/in/foo.cc: In function 'void Main()':
/in/foo.cc:14:10: error: missing template arguments before 'a'
   14 |   vector a(n + 1, vector<int>(m + 1, -1));
      |          ^
/in/foo.cc:17:5: error: 'a' was not declared in this scope
   17 |     a[(n >> 1) + 1][(m >> 1) + 1] = 1;
      |     ^
/in/foo.cc:44:11: error: 'a' was not declared in this scope
   44 |       if (a[x][y] != -1) {
      |           ^
/in/foo.cc:53:13: error: 'a' was not declared in this scope
   53 |         if (a[nx][ny] == c) {
      |             ^
/in/foo.cc:59:7: error: 'a' was not declared in this scope
   59 |       a[n - x + 1][m - y + 1] = !c;
      |       ^

代码

#include <bits/extc++.h>
#define endl '\n'
typedef long long ll;
#define int ll
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

constexpr int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

void Main() {
  int n, m;
  cin >> n >> m;
  vector a(n + 1, vector<int>(m + 1, -1));
  if (n * m & 1) {
    cout << "First" << endl;
    a[(n >> 1) + 1][(m >> 1) + 1] = 1;
    cout << (n >> 1) + 1 << " " << (m >> 1) + 1 << " " << 1 << endl;
    while (true) {
      int x, y, c;
      cin >> x >> y >> c;
      if (a[x][y] != -1) {
        cout << "Buwanle" << endl;
        return;
      }
      for (int i = 0; i < 4; ++i) {
        const int &nx = x + dx[i], &ny = y + dy[i];
        if (nx <= 0 || nx > n || ny <= 0 || ny > m) {
          continue;
        }
        if (a[nx][ny] == c) {
          cout << "Buwanle" << endl;
          return;
        }
      }
      cout << n - x + 1 << " " << m - y + 1 << " " << c << endl;
      a[n - x + 1][m - y + 1] = c;
    }
  } else {
    cout << "Second" << endl;
    while (true) {
      int x, y, c;
      cin >> x >> y >> c;
      if (a[x][y] != -1) {
        cout << "Buwanle" << endl;
        return;
      }
      for (int i = 0; i < 4; ++i) {
        const int &nx = x + dx[i], &ny = y + dy[i];
        if (nx <= 0 || nx > n || ny <= 0 || ny > m) {
          continue;
        }
        if (a[nx][ny] == c) {
          cout << "Buwanle" << endl;
          return;
        }
      }
      cout << n - x + 1 << " " << m - y + 1 << " " << !c << endl;
      a[n - x + 1][m - y + 1] = !c;
    }
  }
}

// #define __CP_MULTI_TEST_CASES

signed main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int t = 1;
#ifdef __CP_MULTI_TEST_CASES
  cin >> t;
#endif
  while (t--) {
    Main();
  }
  return cout << flush, fflush(stdout), 0;
}

信息

递交者
类型
递交
题目
P1000 云剪贴板
题目数据
下载
语言
C++
递交时间
2025-07-14 19:53:18
评测时间
2025-07-14 19:53:18
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes