QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#263756#5419. TrianglesKhNURE_KIVIWA 0ms3812kbC++236.5kb2023-11-25 06:30:592023-11-25 06:31:00

Judging History

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

  • [2023-11-25 06:31:00]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3812kb
  • [2023-11-25 06:30:59]
  • 提交

answer

//#pragma GCC optimize("Ofast", "unroll-loops")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4")

#ifdef __APPLE__

#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <cstdint>
#include <cstring>
#include <string>
#include <cstdlib>
#include <vector>
#include <bitset>
#include <map>
#include <queue>
#include <ctime>
#include <stack>
#include <set>
#include <list>
#include <random>
#include <deque>
#include <functional>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <complex>
#include <numeric>
#include <cassert>
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <thread>

#else
#include <bits/stdc++.h>
#endif

#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
#define fi first
#define se second

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;

template<typename T>
bool umin(T &a, T b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool umax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

#if __APPLE__
#define D for (bool _FLAG = true; _FLAG; _FLAG = false)
#define LOG(...) print(#__VA_ARGS__" ::", __VA_ARGS__) << endl

template<class ...Ts>
auto &print(Ts ...ts) { return ((cerr << ts << " "), ...); }

#else
#define D while (false)
#define LOG(...)
#endif

const int max_n = -1, inf = 1000111222;

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

vector<array<int, 6> > a[11];

void solve() {
    int n;
    cin >> n;
    if(n == 24) {
        cout << "Yes\n"
                "0 0 500000000 0 400000000 300000000\n"
                "1000000000 0 500000000 0 600000000 300000000\n"
                "0 0 0 500000000 300000000 400000000\n"
                "0 1000000000 0 500000000 300000000 600000000\n"
                "0 1000000000 500000000 1000000000 400000000 700000000\n"
                "1000000000 1000000000 500000000 1000000000 600000000 700000000\n"
                "1000000000 1000000000 1000000000 500000000 700000000 600000000\n"
                "1000000000 0 1000000000 500000000 700000000 400000000\n"
                "0 0 400000000 300000000 300000000 400000000\n"
                "0 500000000 300000000 400000000 300000000 600000000\n"
                "0 1000000000 300000000 600000000 400000000 700000000\n"
                "500000000 1000000000 400000000 700000000 600000000 700000000\n"
                "1000000000 1000000000 600000000 700000000 700000000 600000000\n"
                "1000000000 500000000 700000000 600000000 700000000 400000000\n"
                "1000000000 0 700000000 400000000 600000000 300000000\n"
                "500000000 0 400000000 300000000 600000000 300000000\n"
                "500000000 500000000 400000000 300000000 300000000 400000000\n"
                "500000000 500000000 300000000 400000000 300000000 600000000\n"
                "500000000 500000000 300000000 600000000 400000000 700000000\n"
                "500000000 500000000 400000000 700000000 600000000 700000000\n"
                "500000000 500000000 600000000 700000000 700000000 600000000\n"
                "500000000 500000000 700000000 600000000 700000000 400000000\n"
                "500000000 500000000 700000000 400000000 600000000 300000000\n"
                "500000000 500000000 600000000 300000000 400000000 300000000";
        return;
    }
    if(n < 8) {
        cout << "No\n";
        return;
    }
    cout << "Yes\n";
    vector<array<int, 6> > ans;
    vector<array<int, 6> > can_split;
    int st_n = n;
    while(st_n - 3 >= 8) st_n -= 3;
    for(auto& x : a[st_n]) can_split.pb(x);
    while(len(ans) + len(can_split) < n) {
        auto cr = can_split.back(); can_split.pop_back();
        pair<int, int> A = {cr[0], cr[1]}, B = {cr[2], cr[3]}, C = {cr[4], cr[5]};
        if((A.fi + B.fi) % 2 || (A.se + B.se) % 2 || (C.fi + B.fi) % 2 || (C.se + B.se) % 2 || (A.fi + C.fi) % 2 || (A.se + C.se) % 2) {
            ans.push_back(cr);
            continue;
        }
        pair<int, int> AB = {(A.fi + B.fi) / 2, (A.se + B.se) / 2};
        pair<int, int> BC = {(B.fi + C.fi) / 2, (B.se + C.se) / 2};
        pair<int, int> CA = {(A.fi + C.fi) / 2, (A.se + C.se) / 2};
        can_split.pb({A.fi, A.se, AB.fi, AB.se, CA.fi, CA.se});
        can_split.pb({B.fi, B.se, AB.fi, AB.se, BC.fi, BC.se});
        can_split.pb({C.fi, C.se, CA.fi, CA.se, BC.fi, BC.se});
        can_split.pb({AB.fi, AB.se, BC.fi, BC.se, CA.fi, CA.se});
    }
    while(!can_split.empty()) {
        auto cr = can_split.back(); can_split.pop_back();
        for(auto& x : cr) cout << x << ' ';
        cout << '\n';
    }
    while(!can_split.empty()) {
        ans.pb(can_split.back());
        can_split.pop_back();
    }
    for(auto& x : ans) {
        for(auto& xx : x) cout << xx << ' ';
        cout << '\n';
    }
    cout << '\n';
}

signed main() {
//   freopen("input.txt", "r", stdin);
//   freopen("output.txt", "w", stdout);

    a[8].pb({0, 0, 8, 7, 0, 20});
    a[8].pb({0, 20, 8, 7, 10, 20});
    a[8].pb({10, 20, 8, 7, 12, 7});
    a[8].pb({12, 7, 20, 20, 10, 20});
    a[8].pb({12, 7, 20, 0, 20, 20});
    a[8].pb({10, 0, 20, 0, 12, 7});
    a[8].pb({10, 0, 8, 7, 12, 7});
    a[8].pb({0, 0, 10, 0, 8, 7});

    a[9].pb({0, 0, 14, 13, 0, 20});
    a[9].pb({0, 20, 12, 14, 11, 20});
    a[9].pb({11, 20, 12, 14, 14, 15});
    a[9].pb({12, 14, 14, 13, 14, 15});
    a[9].pb({14, 15, 11, 20, 20, 20});
    a[9].pb({14, 15, 20, 20, 20, 14});
    a[9].pb({14, 13, 14, 15, 20, 14});
    a[9].pb({14, 13, 20, 0, 20, 14});
    a[9].pb({0, 0, 20, 0, 14, 13});

    a[10].pb({0, 0, 10, 5, 0, 20});
    a[10].pb({0, 20, 10, 5, 20, 20});
    a[10].pb({20, 0, 10, 5, 20, 20});
    a[10].pb({0, 0, 8, 4, 9, 0});
    a[10].pb({9, 0, 8, 4, 10, 3});
    a[10].pb({10, 3, 10, 5, 8, 4});
    a[10].pb({10, 3, 10, 5, 12, 4});
    a[10].pb({11, 0, 10, 3, 12, 4});
    a[10].pb({9, 0, 11, 0, 10, 3});
    a[10].pb({11, 0, 12, 4, 20, 0});

    for(int i = 8; i <= 10; i++) {
        for(int j = 0; j < len(a[i]); j++)
            for(auto& x : a[i][j])
                x *= 1e9 / 20;
    }

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;

    //cin >> t;

    while (t--) solve();

}

/*
KIVI
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2

output:

No

result:

ok no solution

Test #2:

score: 0
Accepted
time: 0ms
memory: 3696kb

input:

24

output:

Yes
0 0 500000000 0 400000000 300000000
1000000000 0 500000000 0 600000000 300000000
0 0 0 500000000 300000000 400000000
0 1000000000 0 500000000 300000000 600000000
0 1000000000 500000000 1000000000 400000000 700000000
1000000000 1000000000 500000000 1000000000 600000000 700000000
1000000000 100000...

result:

ok 24 acute triangles

Test #3:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

1

output:

No

result:

ok no solution

Test #4:

score: 0
Accepted
time: 0ms
memory: 3744kb

input:

3

output:

No

result:

ok no solution

Test #5:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

4

output:

No

result:

ok no solution

Test #6:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

5

output:

No

result:

ok no solution

Test #7:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

6

output:

No

result:

ok no solution

Test #8:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

7

output:

No

result:

ok no solution

Test #9:

score: -100
Wrong Answer
time: 0ms
memory: 3744kb

input:

8

output:

Yes
0 0 500000000 0 400000000 350000000 
500000000 0 400000000 350000000 600000000 350000000 
500000000 0 1000000000 0 600000000 350000000 
600000000 350000000 1000000000 0 1000000000 1000000000 
600000000 350000000 1000000000 1000000000 500000000 1000000000 
500000000 1000000000 400000000 350000000...

result:

wrong answer triangle 4 not acute