結果
問題 | No.1626 三角形の構築 |
ユーザー | coder_neet |
提出日時 | 2021-08-05 01:09:23 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 3,811 bytes |
コンパイル時間 | 2,155 ms |
コンパイル使用メモリ | 180,340 KB |
実行使用メモリ | 10,404 KB |
最終ジャッジ日時 | 2024-10-12 12:00:40 |
合計ジャッジ時間 | 12,475 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
10,404 KB |
testcase_01 | AC | 320 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
6,820 KB |
testcase_04 | AC | 2 ms
6,820 KB |
testcase_05 | AC | 2 ms
6,816 KB |
testcase_06 | AC | 2 ms
6,816 KB |
testcase_07 | AC | 410 ms
6,816 KB |
testcase_08 | AC | 381 ms
6,816 KB |
testcase_09 | AC | 435 ms
6,820 KB |
testcase_10 | AC | 288 ms
6,820 KB |
testcase_11 | AC | 433 ms
6,820 KB |
testcase_12 | AC | 97 ms
6,824 KB |
testcase_13 | AC | 183 ms
6,820 KB |
testcase_14 | AC | 289 ms
6,816 KB |
testcase_15 | AC | 210 ms
6,820 KB |
testcase_16 | AC | 280 ms
6,816 KB |
testcase_17 | AC | 321 ms
6,816 KB |
testcase_18 | AC | 374 ms
6,816 KB |
testcase_19 | AC | 340 ms
6,816 KB |
testcase_20 | AC | 383 ms
6,816 KB |
testcase_21 | AC | 340 ms
6,816 KB |
testcase_22 | AC | 518 ms
6,816 KB |
testcase_23 | AC | 568 ms
6,820 KB |
testcase_24 | TLE | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
ソースコード
#include <bits/stdc++.h> //#include <atcoder/all> #define int long long #define rep(i,a) for (int i = 0; i < (a); i++ ) #define Rep(i,start,a) for (int i = start; i < (a); i++ ) #define ALL(vec) (vec).begin(), (vec).end() #define Sort(vec) sort((vec).begin(), (vec).end()) // 小さい順 #define SORT(vec) sort((vec).begin(), (vec).end(), [](auto a, auto b){return a>b;}) // 大きい順 #define SORTll(vec) sort((vec).begin(), (vec).end(), [](long long a, long long b){return a>b;}) // 大きい順 #define debug(x) cerr << #x << " = " << (x) << endl #define Bit(s,k) (s>>k)&1 #define VI vector<int> #define VLL vector<long long> #define PII pair<int,int> #define VPII vector<PII> #define VB vector<bool> #define VVI vector<vector<int>> #define VVVI vector<vector<vector<int>>> #define Graph vector<vector<int>> #define PB emplace_back #define USI unordered_set<int> #define Maze vector<string> #define Pqueue priority_queue #define MP make_pair #define WeightedGraph vector<vector<pair<int,ll>>> // parent, (to, cost) #define vecdebug(vec) {cerr << #vec << " = [" ; for(auto x : (vec)){cerr << (x) << ", ";} cerr << "]" << endl; } #define vdebug(vec,i) cerr << #vec << "[" << (i) << "] = " << (vec)[(i)] << endl #define vvdebug(vec,i,j) cerr << #vec << "[" << (i) << "][" << (j) << "] = " << (vec)[(i)][(j)] << endl #define vvvdebug(vec,i,j,k) cerr << #vec << "[" << (i) << "][" << (j) << "][" << (k) <<"] = " << (vec)[(i)][(j)][(k)] << endl #define pdebug(p) cerr << #p << " = [" << (p).first << ", " << (p).second << "]" << endl typedef long long ll; typedef long double ld; const int mod = 998244353; const int MOD = 1000000007; const ll INFLL = (1LL << 60) -1; const int INF = (1 << 30) -1; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; const long double pi = 2*asin(1); using namespace std; //using namespace atcoder; //using mint = modint1000000007; //using mint = modint998244353; //using mint = modint998244353; //using mint = static_modint<7>; template<typename T> inline void chmin(T &x, T y){if(x>y) x=y;} template<typename T> inline void chmax(T &x, T y){if(x<y) x=y;} inline int tonum(char X){ if(X >= 'A' && X <= 'Z') return 26 + (int)(X-'A'); return (int)(X - 'a'); } inline int ctoi(char x){return (int)(x-'0');} template<typename T> T Max(T x, T y){if(x>y) return x; return y;} template<typename T> T Min(T x, T y){if(x<y) return x; return y;} inline int tochar(int n){return (char)('a' + n);} template<typename T> inline T ABS(T n){if(n<0) return -n; return n;} ll GCD(ll a, ll b){if(a%b==0) return b; return GCD(b,a%b);} ll LCM(ll a, ll b){return a / GCD(a,b) *b;} vector<int> divisors(int n){ vector<int> ret; Rep(i,1,n+1){ if(i*i>n) break; if(i*i==n){ ret.PB(i); break; } if(n%i==0){ ret.PB(i); ret.PB(n/i); } } sort(ret.begin(), ret.end()); return ret; } void solve(){ int S,T; cin >> S >> T; if((4 * S * S) % T != 0){ cout << 0 << endl; return; } //debug("!"); set<PII> st; auto div = divisors(16 * S * S / T); //vecdebug(div); int sz = div.size(); int val = 16 * S * S / T; rep(i,sz){ if(3 * div[i] > T) break; Rep(j,i,sz){ int x = div[i]; int y = div[j]; if(x + 2 * y > T) break; if((x + y) & 1) continue; if((T - x) & 1) continue; if(val / x == y * (T - x - y)) st.insert(MP(x,y)); } } cout << st.size() << endl; for(auto p : st){ int x = p.first; int y = p.second; int z = T - x - y; int a = (x + y) / 2; int b = (y + z) / 2; int c = (z + x) / 2; cout << a << " " << b << " " << c << endl; } } signed main(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(16); int Query; cin >> Query; rep(_,Query) solve(); }