結果
問題 | No.1113 二つの整数 / Two Integers |
ユーザー |
![]() |
提出日時 | 2020-10-09 19:59:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 2,182 bytes |
コンパイル時間 | 1,752 ms |
コンパイル使用メモリ | 177,620 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 07:53:24 |
合計ジャッジ時間 | 2,586 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 |
ソースコード
#include<bits/stdc++.h>using namespace std;using ll = long long;using ull = unsigned long long;using V = vector<int>;using VV = vector<V>;using VVV = vector<VV>;using VL = vector<ll>;using VVL = vector<VL>;using VVVL = vector<VVL>;template<class T> using VE = vector<T>;template<class T> using P = pair<T, T>;#define rep(i,n) for(int i=0;i<(n);i++)#define rep1(i,n) for(int i=1;i<=(n);i++)#define REP(i,k,n) for(int i=(k);i<(n);i++)#define all(a) (a).begin(),(a).end()#define output(x,y) cout << fixed << setprecision(y) << x << endl;template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }// const ll MOD = 1e9 + 7;const ll MOD = 998244353;ll upper = MOD + MOD;ll under = -upper;ll UPPER = MOD * MOD;ll UNDER = -UPPER;const long double pi = 3.141592653589793;const int N = 105;VE<P<int>> Pt(N);VE<VE<P<int>>> g(N);bool cheak(P<int> pre, P<int> now, P<int> nxt) { // 前、今、次,ベクトルの内積が-かどうか判定P<int> BA = { pre.first - now.first,pre.second - now.second };P<int> BC = { nxt.first - now.first,nxt.second - now.second };ll prod = BA.first * BC.first + BA.second * BC.second;return prod <= 0;}V dp(N, upper);void dijkstra() {priority_queue<pair<int,P<int>>, VE<pair<int, P<int>>>, greater<pair<int, P<int>>>> pq;pq.push({ 0,{-1,0} }); // 距離、前、今while (!pq.empty()) {int d = pq.top().first;int pre = pq.top().second.first;int now = pq.top().second.second;pq.pop();// if (d > dp[now]) continue;rep(i, g[now].size()) {int nxt = g[now][i].first;int cost = g[now][i].second;bool ok = (pre == -1) ? true : cheak(Pt[pre], Pt[now], Pt[nxt]);if (!ok) continue;if (chmin(dp[nxt], dp[now] + cost)) {pq.push({ d + cost,{now,nxt} });}}}}int main() {ll a, b;cin >> a >> b;ll G = gcd(a, b);ll Sq = sqrt(G);if (Sq * Sq == G) {cout << "Odd" << endl;}else {cout << "Even" << endl;}return 0;}