Submission #6492074


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
#define fi first
#define se second
Int mod = 1e9+7;
Int INF = 1e18;
double EPS = 0.00000001;
//Int mod = 998244353;

int main() {
    Int s;
    cin >> s;
    Int x[6] = {};
    x[0] = x[1] = 0;
    if (s <= 1e9) {
        x[2] = 0;
        x[3] = 1;
        x[4] = s;
        x[5] = 0;
        for (Int i = 0; i < 6; i++) cout << x[i] << " ";
        cout << endl;
    }
    else {
        Int ok = 1e9;
        Int ng = 0;
        while (abs(ok - ng) > 1) {
            Int mid = (ok + ng) / 2;
            if (s <= mid * mid)  {
                ok = mid;
            }
            else {
                ng = mid;
            }
        }
        x[2] = x[5] = ok;
        Int bc = ok * ok - s;
        if (bc == 0) {
            x[3] = x[4] = 0;
        }
        else {
            x[3] = 1;
            x[4] = bc;
        }
        for (Int i = 0; i < 6; i++) cout << x[i] << " ";
        cout << endl;
        //cout << ok * ok - bc << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task A - Triangle
User keep_OC
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1121 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 16
Set Name Test Cases
Sample sample-01.txt, sample-02.txt, sample-03.txt
All 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt AC 1 ms 256 KB
01-02.txt AC 1 ms 256 KB
01-03.txt AC 1 ms 256 KB
01-04.txt AC 1 ms 256 KB
01-05.txt AC 1 ms 256 KB
01-06.txt AC 1 ms 256 KB
01-07.txt AC 1 ms 256 KB
01-08.txt AC 1 ms 256 KB
01-09.txt AC 1 ms 256 KB
01-10.txt AC 1 ms 256 KB
01-11.txt AC 1 ms 256 KB
01-12.txt AC 1 ms 256 KB
01-13.txt AC 1 ms 256 KB
sample-01.txt AC 1 ms 256 KB
sample-02.txt AC 1 ms 256 KB
sample-03.txt AC 1 ms 256 KB