Submission #371954


Source Code Expand

#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double R;
typedef tuple<ll, ll, ll, ll> Q;

Q solve(R xx, R yy) {
//    printf("%Lf %Lf\n", xx, yy);
    xx *= 1000; yy *= 1000;
//    printf("%Lf %Lf\n", xx, yy);
    ll x = (ll)round(xx), y = (ll)round(yy);
    ll xm = x % 1000, ym = y % 1000;
    xm = (xm + 1000) % 1000;
    if (!xm) xm = 1000;
    ym = (ym + 1000) % 1000;
    if (!ym) ym = 1000;
//    printf("d%lld %lld %lld %lld\n", x, y, xm, ym);
    if (xm == 0 && ym == 0) {
        xm = ym = 1;
    }
    ll xd = (x - xm) / 1000, yd = (y - ym) / 1000;    
    return Q(xd, yd, xd-xm, yd-ym);
}

int main() {
    R xx, yy;
    cin >> xx >> yy;
    ll a, b, c, d;
    tie(a, b, c, d) = solve(xx, yy);
    printf("%lld %lld %lld %lld\n", a, b, c, d);
    tie(a, b, c, d) = solve(xx, -yy);
    b = -b; d = -d;
    printf("%lld %lld %lld %lld\n", a, b, c, d);
    return 0;
}

Submission Info

Submission Time
Task B - 交点
User yosupo
Language C++11 (GCC 4.9.2)
Score 100
Code Size 1155 Byte
Status AC
Exec Time 27 ms
Memory 932 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 27
Set Name Test Cases
All scrambled_00.txt, scrambled_01.txt, scrambled_02.txt, scrambled_03.txt, scrambled_04.txt, scrambled_05.txt, scrambled_06.txt, scrambled_07.txt, scrambled_08.txt, scrambled_09.txt, scrambled_10.txt, scrambled_11.txt, scrambled_12.txt, scrambled_13.txt, scrambled_14.txt, scrambled_15.txt, scrambled_16.txt, scrambled_17.txt, scrambled_18.txt, scrambled_19.txt, scrambled_20.txt, scrambled_21.txt, scrambled_22.txt, scrambled_23.txt, scrambled_24.txt, scrambled_25.txt, scrambled_26.txt
Case Name Status Exec Time Memory
scrambled_00.txt AC 25 ms 924 KB
scrambled_01.txt AC 27 ms 776 KB
scrambled_02.txt AC 24 ms 800 KB
scrambled_03.txt AC 24 ms 924 KB
scrambled_04.txt AC 26 ms 812 KB
scrambled_05.txt AC 26 ms 916 KB
scrambled_06.txt AC 25 ms 916 KB
scrambled_07.txt AC 25 ms 920 KB
scrambled_08.txt AC 25 ms 924 KB
scrambled_09.txt AC 26 ms 924 KB
scrambled_10.txt AC 25 ms 924 KB
scrambled_11.txt AC 24 ms 932 KB
scrambled_12.txt AC 24 ms 932 KB
scrambled_13.txt AC 26 ms 916 KB
scrambled_14.txt AC 24 ms 804 KB
scrambled_15.txt AC 25 ms 920 KB
scrambled_16.txt AC 23 ms 920 KB
scrambled_17.txt AC 25 ms 916 KB
scrambled_18.txt AC 25 ms 796 KB
scrambled_19.txt AC 24 ms 800 KB
scrambled_20.txt AC 25 ms 920 KB
scrambled_21.txt AC 25 ms 804 KB
scrambled_22.txt AC 26 ms 812 KB
scrambled_23.txt AC 24 ms 928 KB
scrambled_24.txt AC 26 ms 796 KB
scrambled_25.txt AC 26 ms 732 KB
scrambled_26.txt AC 26 ms 732 KB