QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#640800 | #6812. Draw a triangle | wangcq | WA | 19ms | 3732kb | C++23 | 1.1kb | 2024-10-14 16:08:45 | 2024-10-14 16:08:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
const int N = 100010;
typedef long long ll;
typedef pair<int, int> pii;
std::mt19937 rng {std::chrono::steady_clock::now().time_since_epoch().count()};
template <typename T>
void debug(T x) {
cerr << x << '\n';
}
template <typename T, typename... Args>
void debug(T x, Args... args) {
cerr << x << ' ';
debug(args...);
}
// op1
// sum = sum * 2 + ma * n;
// ma = ma * 2;
// n = n * 2;
ll exgcd(ll a, ll b, ll &x, ll &y){
if(b){
ll d = exgcd(b, a % b, y, x);
// gcd(b, a mod b) = gcd(a, b) = y * b + x * (a - b * a / b)
y -= a / b * x;
return d;
}
else{
x = 1;
y = 0;
return a;
}
}
void solve() {
ll x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
ll x, y;
exgcd(abs(y1 - y2), abs(-(x1 + x2)), x, y);
cout << x << ' ' << y << '\n';
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T = 1;
cin >> T;
while (T -- ) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3732kb
input:
3 1 0 1 4 0 1 0 9 0 0 2 2
output:
0 1 1 0 0 1
result:
ok T=3 (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 19ms
memory: 3720kb
input:
50000 66620473 -33485015 66620223 -33485265 43307886 98029243 43307636 98028994 -88895230 -3180782 -88895480 -3181030 -90319745 20018595 -90319995 20018348 -56783257 84789686 -56783507 84789440 -81798038 90629147 -81798288 90628902 98942945 -939146 98942695 -939390 -42532151 -57203475 -42532401 -572...
output:
-19719623 37 -695707 2 29392819 -41 72402163 -99 -923307 2 -44070847 66 14598121 -18 -9101557 26 -7074391 16 4275383 -19 155023 -7 -23790661 70 -2002102 5 -6275387 8 8797499 -12 16054553 -23 1297399 -2 -273107 74 -106610 1 12618259 -59 -7323370 9 10813393 -41 -37045770 43 16568607 -38 10551314 -33 -...
result:
wrong answer wa on query #1 (test case 1)