QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#643766#7970. 三步棋hos_lyric#AC ✓1ms3668kbC++142.0kb2024-10-15 23:55:462024-10-15 23:55:46

Judging History

This is the latest submission verdict.

  • [2024-10-15 23:55:46]
  • Judged
  • Verdict: AC
  • Time: 1ms
  • Memory: 3668kb
  • [2024-10-15 23:55:46]
  • Submitted

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")


char A[10][10];

int main() {
  for (int numCases; ~scanf("%d", &numCases); ) { for (int caseId = 1; caseId <= numCases; ++caseId) {
    for (int x = 0; x < 5; ++x) {
      scanf("%s", A[x]);
    }
    
    int cnt = 0;
    set<int> xs, ys;
    for (int x = 0; x < 5; ++x) for (int y = 0; y < 5; ++y) if (A[x][y] == 'o') {
      ++cnt;
      xs.insert(x);
      ys.insert(y);
    }
    
    bool ans = false;
    if (cnt == 2) {
      ans = true;
    }
    if (cnt == 4) {
      ans = true;
      if (xs.size() == 1) ans = false;
      if (ys.size() == 1) ans = false;
      if (xs.size() == 2 && ys.size() == 2) ans = false;
    }
    puts(ans ? "Far" : "Away");
  }
#ifndef LOCAL
  break;
#endif
  }
  return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3636kb

input:

200
.....
..oo.
.....
.....
.....
.....
.....
oo...
o....
.....
.....
.o...
oo...
.....
.....
.....
.....
o....
oo...
.....
.....
...o.
..oo.
.....
.....
.....
....o
.....
.....
.....
.....
.....
.....
.ooo.
.o...
.....
.....
.....
.....
...oo
.o...
.o...
.o...
.....
.....
.....
.....
..oo.
.....
.....

output:

Far
Away
Away
Away
Away
Away
Far
Far
Away
Far
Away
Far
Far
Away
Far
Away
Far
Away
Away
Away
Far
Away
Far
Away
Away
Away
Away
Far
Far
Far
Far
Away
Far
Away
Far
Away
Far
Away
Away
Far
Away
Away
Far
Far
Away
Far
Far
Away
Far
Away
Away
Away
Away
Away
Away
Far
Away
Far
Away
Away
Away
Away
Far
Away
Far
Fa...

result:

ok 200 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

200
...oo
..oo.
.....
.....
.....
.....
..ooo
....o
.....
.....
.....
o....
oo...
.o...
.....
.....
.ooo.
...o.
.....
.....
.....
.oo..
..oo.
.....
.....
.....
...o.
...o.
...o.
...o.
.....
.oo..
..o..
..o..
.....
..o..
..ooo
.....
.....
.....
.....
.oooo
.....
.....
.....
.....
.....
o....
oo...
o....

output:

Far
Far
Far
Far
Far
Away
Far
Far
Away
Far
Far
Far
Far
Away
Far
Far
Far
Far
Far
Far
Far
Far
Far
Far
Far
Away
Far
Far
Far
Far
Away
Far
Away
Far
Far
Far
Away
Far
Far
Far
Far
Far
Far
Far
Far
Away
Far
Far
Far
Far
Far
Far
Away
Far
Away
Far
Far
Far
Away
Away
Far
Far
Far
Far
Away
Far
Far
Far
Far
Far
Far
Far...

result:

ok 200 lines