QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#412951#8669. 正方形计数Xiaohuba0 1ms3592kbC++233.8kb2024-05-16 22:06:492024-05-16 22:06:49

Judging History

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

  • [2024-05-16 22:06:49]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3592kb
  • [2024-05-16 22:06:49]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

// #define LOCK_GETCHAR
// #define USE_INT_128

#if __cplusplus < 201400
#warning "Please use c++14 or higher."
#define CONSTEXPR_FUNC
#define ENABLE_IF_INT
#else
#define CONSTEXPR_FUNC constexpr
#define ENABLE_IF_INT , enable_if_t<_is_integer<T>, int> = 0
template <class T> constexpr bool _is_integer = numeric_limits<T>::is_integer;
template <> constexpr bool _is_integer<bool> = false;
template <> constexpr bool _is_integer<char> = false;
#ifdef USE_INT_128
template <> constexpr bool _is_integer<__int128> = true;
template <> constexpr bool _is_integer<__uint128_t> = true;
#endif
template <class T ENABLE_IF_INT>
constexpr T INF = numeric_limits<T>::max() >> 1;
#endif

#if !defined(_WIN32) && !defined(LOCK_GETCHAR)
#define getchar getchar_unlocked
#endif

#define il inline
#define mkp make_pair
#define fi first
#define se second
#define For(i, j, k) for (decltype(j - k) i = (j); i <= (k); ++i)     // NOLINT
#define ForDown(i, j, k) for (decltype(j - k) i = (j); i >= (k); --i) // NOLINT
#define pb push_back
#define eb emplace_back
#ifndef ONLINE_JUDGE
#define FileIO(filename)                                                       \
  freopen(filename ".in", "r", stdin);                                         \
  freopen(filename ".out", "w", stdout)
#else
#define FileIO(filename) void(0)
#endif

using ll = long long;
using uint = unsigned int;
using ull = unsigned long long;
using db = double;
using ldb = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#ifdef USE_INT_128
using lll = __int128_t;
using ulll = __uint128_t;
#endif

// clang-format off
#define lg(x) (31 ^ __builtin_clz((x)))
#define lgll(x) (31ll ^ __builtin_clzll((x)))
template<typename T> constexpr il T sq(const T & x){ return x * x; }
template<typename T> CONSTEXPR_FUNC il void cmin(T & x, const T &y){ x = min(x, y); }
template<typename T> CONSTEXPR_FUNC il void cmax(T & x, const T &y){ x = max(x, y);}
template<typename T> CONSTEXPR_FUNC il T qpow(T x, ull y, T mod){T ans = 1; x %= mod; while (y) { if(y & 1)(ans *= x) %= mod;(x *= x) %= mod; y >>= 1;} return ans;}
template<typename T> CONSTEXPR_FUNC il T qpow(T x, ull y){T ans = 1; while (y) {if(y & 1) ans *= x;x *= x;y >>= 1;} return ans;}
template<typename T ENABLE_IF_INT> il void read(T &x){ x = 0; int f = 1; int c = getchar(); while(!isdigit(c)) {if (c == '-') f = -1;c = getchar();} while(isdigit(c)) {x = x * 10 + c - '0';c = getchar();} x *= f;}
template<typename T, typename ... Args> il void read(T &x, Args &... y){ read(x); read(y...); }
int gcd(int a, int b) { if (!a | !b) return a + b; int az = __builtin_ctz(a); int bz = __builtin_ctz(b); int z = min(az, bz); a >>= az, b >>= bz; while (a != b) { int diff = b - a; az = __builtin_ctz(diff); b = min(a, b), a = abs(diff) >> az; } return a << z; }
ll gcd(ll a, ll b) { if (!a | !b) return a + b; ll az = __builtin_ctzll(a); ll bz = __builtin_ctzll(b); ll z = min(az, bz); a >>= az, b >>= bz; while (a != b) { ll diff = b - a; az = __builtin_ctzll(diff); b = min(a, b), a = abs(diff) >> az; } return a << z; }
// clang-format on

// File head end

namespace {
// constexpr ll MAXN = ...;
int n;
pii a[10];
bool chk(int x, int y) {
  pii pre = {a[1].fi - x, a[1].se - y};
  For(i, 2, n + 1) {
    pii nxt = {a[i].fi - x, a[i].se - y};
    if (pre.fi * nxt.se - pre.se * nxt.fi > 1e-8)
      return 0;
    pre = nxt;
  }
  return 1;
}
il void Main() {
  read(n);
  For(i, 1, n) read(a[i].fi, a[i].se);
  a[n + 1] = a[1];
  int ans = 0;
  For(x1, 0, 15) For(y1, 0, 15) For(x2, x1 + 1, 15) For(y2, x1, 15) {
    int x3 = x1 - (y2 - y1), y3 = y1 + (x2 - x1);
    int x4 = x3 + (x2 - x1), y4 = y3 + (y2 - y1);
    ans += chk(x1, y1) & chk(x2, y2) & chk(x3, y3) & chk(x4, y4);
  }
  cout << ans << '\n';
}
} // namespace

signed main() { return Main(), 0; }

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3492kb

input:

4
131 603
131 1828
1919 1828
1919 603

output:

0

result:

wrong answer 1st numbers differ - expected: '361182910200', found: '0'

Subtask #2:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 1ms
memory: 3572kb

input:

3
131 603
131 1828
1919 603

output:

0

result:

wrong answer 1st numbers differ - expected: '63739309181', found: '0'

Subtask #3:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 1ms
memory: 3592kb

input:

8
0 13
4 15
15 15
15 6
13 1
12 0
5 0
0 6

output:

4194

result:

wrong answer 1st numbers differ - expected: '4047', found: '4194'

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%