QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#254401 | #5544. Grid Game | warner1129 | WA | 0ms | 3820kb | C++20 | 1.7kb | 2023-11-18 12:05:47 | 2023-11-18 12:05:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
template<class... T> void dbg(T... x) { char e{}; ((cerr << e << x, e = ' '), ...); }
template<class T> void org(T l, T r) { while (l != r) cerr << ' ' << *l++; cerr << '\n'; }
#define debug(x...) dbg(#x, '=', x, '\n')
#define olist(x...) dbg(#x, '='), org(x)
#else
#define debug(...) ((void)0)
#define olist(...) ((void)0)
#endif
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define ff first
#define ss second
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using i128 = __int128;
using u128 = unsigned __int128;
template<class T>
inline constexpr T inf = numeric_limits<T>::max() / 2;
constexpr int mod = 998244353;
template<class T> bool chmin(T &a, T b) { return (b < a and (a = b, true)); }
template<class T> bool chmax(T &a, T b) { return (a < b and (a = b, true)); }
template<class... T> int add(T... x) { int t{}; return (((t += x) %= mod), ...), t; }
template<class... T> int mul(T... x) { i64 t{1}; return (((t *= x) %= mod), ...), t; }
void solve() {
int n, m;
cin >> n >> m;
vector G(n, vector<int>(m));
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++) {
cin >> G[i][j];
}
int s = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++) {
if ((i == n - 1 or G[i + 1][j] == -1) and (j == m - 1 or G[i][j + 1] == -1)) {
s ^= G[i][j];
}
}
cout << (s == 0 ? "second\n" : "first\n");
}
signed main() {
cin.tie(0)->sync_with_stdio(false);
cin.exceptions(cin.failbit);
int T = 1;
// cin >> T;
while (T--) {
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3820kb
input:
5 6 0 0 0 0 0 0 0 3 3 0 0 0 0 0 3 -1 0 0 0 0 3 3 3 3 0 0 -1 -1 -1 -1
output:
first
result:
ok single line: 'first'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
2 2 1 1 2 -1
output:
first
result:
ok single line: 'first'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3804kb
input:
1 1 -1
output:
first
result:
wrong answer 1st lines differ - expected: 'second', found: 'first'