QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#263776 | #5419. Triangles | KhNURE_KIVI | WA | 1ms | 3752kb | C++23 | 4.7kb | 2023-11-25 06:57:03 | 2023-11-25 06:57:04 |
Judging History
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 < 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, 9, 5, 0, 20});
a[8].pb({0, 20, 9, 5, 10, 20});
a[8].pb({10, 20, 9, 5, 11, 5});
a[8].pb({11, 5, 20, 20, 10, 20});
a[8].pb({11, 5, 20, 0, 20, 20});
a[8].pb({10, 0, 20, 0, 11, 5});
a[8].pb({10, 0, 9, 5, 11, 5});
a[8].pb({0, 0, 10, 0, 9, 5});
a[9].pb({0, 0, 14, 13, 0, 20});
a[9].pb({0, 20, 10, 15, 12, 20});
a[9].pb({12, 20, 10, 15, 15, 16});
a[9].pb({10, 15, 14, 13, 15, 16});
a[9].pb({15, 16, 12, 20, 20, 20});
a[9].pb({15, 16, 20, 20, 20, 14});
a[9].pb({14, 13, 15, 16, 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, 2});
a[10].pb({10, 2, 10, 5, 8, 4});
a[10].pb({10, 2, 10, 5, 12, 4});
a[10].pb({11, 0, 10, 2, 12, 4});
a[10].pb({9, 0, 11, 0, 10, 2});
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: 3520kb
input:
2
output:
No
result:
ok no solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
24
output:
Yes 553125000 223437500 562500000 203125000 584375000 223437500 593750000 203125000 584375000 223437500 562500000 203125000 531250000 203125000 553125000 223437500 562500000 203125000 575000000 243750000 553125000 223437500 584375000 223437500 550000000 162500000 593750000 203125000 531250000 20...
result:
ok 24 acute triangles
Test #3:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
1
output:
No
result:
ok no solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
3
output:
No
result:
ok no solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
4
output:
No
result:
ok no solution
Test #6:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
5
output:
No
result:
ok no solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
6
output:
No
result:
ok no solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
7
output:
No
result:
ok no solution
Test #9:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
8
output:
Yes 0 0 500000000 0 450000000 250000000 500000000 0 450000000 250000000 550000000 250000000 500000000 0 1000000000 0 550000000 250000000 550000000 250000000 1000000000 0 1000000000 1000000000 550000000 250000000 1000000000 1000000000 500000000 1000000000 500000000 1000000000 450000000 250000000...
result:
ok 8 acute triangles
Test #10:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
9
output:
Yes 0 0 1000000000 0 700000000 650000000 700000000 650000000 1000000000 0 1000000000 700000000 700000000 650000000 750000000 800000000 1000000000 700000000 750000000 800000000 1000000000 1000000000 1000000000 700000000 750000000 800000000 600000000 1000000000 1000000000 1000000000 500000000 750...
result:
ok 9 acute triangles
Test #11:
score: -100
Wrong Answer
time: 0ms
memory: 3612kb
input:
10
output:
Yes 550000000 0 600000000 200000000 1000000000 0 450000000 0 550000000 0 500000000 100000000 550000000 0 500000000 100000000 600000000 200000000 500000000 100000000 500000000 250000000 600000000 200000000 500000000 100000000 500000000 250000000 400000000 200000000 450000000 0 400000000 20000000...
result:
wrong answer triangle 3 not acute