QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#788115#6620. Linear Fractional TransformationExtractStarsWA 127ms4004kbC++203.0kb2024-11-27 15:59:022024-11-27 15:59:05

Judging History

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

  • [2024-11-27 15:59:05]
  • 评测
  • 测评结果:WA
  • 用时:127ms
  • 内存:4004kb
  • [2024-11-27 15:59:02]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define ft first
#define sd second

#define yes cout << "yes\n"
#define no cout << "no\n"

#define Yes cout << "Yes\n"
#define No cout << "No\n"

#define YES cout << "YES\n"
#define NO cout << "NO\n"

#define pb push_back
#define eb emplace_back

#define all(x) x.begin(), x.end()
#define all1(x) x.begin() + 1, x.end()
#define unq_all(x) x.erase(unique(all(x)), x.end())
#define unq_all1(x) x.erase(unique(all1(x)), x.end())
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3fLL

#define RED cout << "\033[91m"     // 红色
#define GREEN cout << "\033[92m"   // 绿色
#define YELLOW cout << "\033[93m"  // 蓝色
#define BLUE cout << "\033[94m"    // 品红
#define MAGENTA cout << "\033[95m" // 青色
#define CYAN cout << "\033[96m"    // 青色
#define RESET cout << "\033[0m"    // 重置

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
// typedef __int128_t i128;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<string, ll> psl;

typedef tuple<int, int, int> ti3;
typedef tuple<ll, ll, ll> tl3;
typedef tuple<ld, ld, ld> tld3;

typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

// std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());

template <typename T>
inline T read()
{
    T x = 0;
    int y = 1;
    char ch = getchar();
    while (ch > '9' || ch < '0')
    {
        if (ch == '-')
            y = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9')
    {
        x = (x << 3) + (x << 1) + (ch ^ 48);
        ch = getchar();
    }
    return x * y;
}

template <typename T>
inline void write(T x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    if (x >= 10)
    {
        write(x / 10);
    }
    putchar(x % 10 + '0');
}

/*#####################################BEGIN#####################################*/
using cd = complex<double>;
void solve()
{
    int p1, q1, r1, s1;
    cin >> p1 >> q1 >> r1 >> s1;
    cd z1(p1, q1);
    cd w1(r1, s1);

    int p2, q2, r2, s2;
    cin >> p2 >> q2 >> r2 >> s2;
    cd z2(p2, q2);
    cd w2(r2, s2);

    int p3, q3, r3, s3;
    cin >> p3 >> q3 >> r3 >> s3;
    cd z3(p3, q3);
    cd w3(r3, s3);

    int p0, q0;
    cin >> p0 >> q0;
    cd z0(p0, q0);

    cd k = ((z0 - z1) / (z0 - z3)) * ((z2 - z3) / (z2 - z1)) * ((w2 - w3) / (w2 - w1));
    cd w0 = (w3 - k * w1) / (1.0 - k);

    cout << fixed << setprecision(15) << w0.real() << " " << w0.imag() << "\n";
}

int main()
{
    ios::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0);
    // freopen("test.in", "r", stdin);
    // freopen("test.out", "w", stdout);
    int _ = 1;
    std::cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}

/*######################################END######################################*/
// 链接:

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4004kb

input:

2
-1 0 0 -1
0 1 -1 0
1 0 0 1
0 -1
-1 0 -1 0
0 1 0 -1
1 0 1 0
0 -1

output:

1.000000000000000 0.000000000000000
0.000000000000000 1.000000000000000

result:

ok 4 numbers

Test #2:

score: -100
Wrong Answer
time: 127ms
memory: 3784kb

input:

100000
0 0 -1 1
1 1 1 0
1 0 1 -1
-1 0
-1 -1 -1 1
1 -1 1 -1
-1 0 1 0
-1 -1
-1 -1 0 -1
-1 1 -1 -1
0 -1 0 0
1 1
1 0 0 -1
0 0 0 0
-1 -1 1 0
1 1
-1 -1 0 -1
0 1 1 -1
1 0 -1 -1
1 -1
0 1 1 -1
1 0 1 0
0 -1 0 1
-1 -1
1 1 -1 1
0 0 -1 -1
0 1 0 1
1 0
1 1 1 -1
0 1 -1 -1
1 0 -1 0
1 -1
1 0 -1 1
-1 -1 1 0
0 -1 0 1
0...

output:

0.811320754716981 -0.660377358490566
1.000000000000000 0.000000000000000
-0.615384615384615 -1.076923076923077
2.000000000000000 1.000000000000000
-0.278688524590164 -1.065573770491803
1.000000000000000 -2.000000000000000
0.600000000000000 0.200000000000000
-0.000000000000000 -3.000000000000000
0.25...

result:

wrong answer 1st numbers differ - expected: '1.0000000', found: '0.8113208', error = '0.1886792'