結果
| 問題 | No.638 Sum of "not power of 2" | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-01-27 00:17:59 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                MLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,075 bytes | 
| コンパイル時間 | 806 ms | 
| コンパイル使用メモリ | 77,268 KB | 
| 実行使用メモリ | 818,024 KB | 
| 最終ジャッジ日時 | 2024-09-19 16:57:11 | 
| 合計ジャッジ時間 | 2,931 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | -- * 2 | 
| other | AC * 8 MLE * 1 -- * 3 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<ll, ll> P;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向
ll n;
void input(){
    cin >> n;
}
bool check(ll x){
    while(x != 1){
        if (x % 2 == 1) return false;
        x /= 2;
    }
    return true;
} // 2の整数乗ならtrue、そうでないならfalse
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    vector<P> ab;
    for(ll a=1;a<n;a++){
        ab.push_back(P(a, n - a));
    }
    sort(ab.begin(), ab.end());
    for(ll i = 0; i < ab.size(); i++){
        if (check(ab[i].first) || check(ab[i].second)) continue;
        cout << ab[i].first << ' ' << ab[i].second << endl;
        return 0; 
    }
    cout << (-1) << endl;
    return 0;
}
            
            
            
        