結果

問題 No.687 E869120 and Constructing Array 1
ユーザー uxux
提出日時 2024-03-03 04:20:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 3,565 bytes
コンパイル時間 3,828 ms
コンパイル使用メモリ 226,364 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-09-29 16:43:30
合計ジャッジ時間 2,975 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,820 KB
testcase_02 AC 2 ms
6,816 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,820 KB
testcase_07 AC 1 ms
6,820 KB
testcase_08 AC 2 ms
6,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>    // tree
#include <ext/pb_ds/tree_policy.hpp>        // tree
/* // 多倍長整数
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using Bint = cpp_int;
*/
using namespace std;
using namespace __gnu_pbds;                 // tree
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<long long>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vd = vector<double>;
using vld = vector<long double>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using vvb = vector<vector<bool>>;
using vvd = vector<vector<double>>;
using vvld = vector<vector<long double>>;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<long long, long long>>;
using vpcc = vector<pair<char, char>>;
using vpss = vector<pair<string, string>>;
using sti = set<int>;
using stl = set<long, long>;
using stc = set<char>;
using sts = set<string>;
using primax_int = priority_queue<int>;
using primin_int = priority_queue<int, vector<int>, greater<int>>;
using primax_ll = priority_queue<ll>;
using primin_ll = priority_queue<ll, vector<ll>, greater<ll>>;
using primax_char = priority_queue<char>;
using primin_char = priority_queue<char, vector<char>, greater<char>>;
using primax_string = priority_queue<string>;
using primin_string = priority_queue<string, vector<string>, greater<string>>;
using tree_int = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
using tree_ll = tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;
using tree_char = tree<char, null_type, less<char>, rb_tree_tag, tree_order_statistics_node_update>;
using tree_string = tree<string, null_type, less<string>, rb_tree_tag, tree_order_statistics_node_update>;

#define endl "\n"
#define YES printf("YES\n");
#define Yes printf("Yes\n");
#define NO printf("NO\n");
#define No printf("No\n");
#define rep0(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define ALL(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int INF = 1e9;
const int MININF = -1e9;
const ll LINF = 1e18;
const ll MINLINF = -1e18;
const int MOD = 1e9 + 7;
const int MODD = 998244353;
const char MARU = 'o';
const char BATU = 'x';

// 8方向(4方向ならN=4で止め。)
vi vx = {0, 1, 0, -1, 1, -1, 1, -1};
vi vy = {1, 0, -1, 0, 1, -1, -1, 1};

template <class T>
bool chmax(T &a, const T& b){
    if(a < b){a = b;return true;}
    return false;
}

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

// 切り捨て(A/B以下の最大の整数)
template <class T>
T div_floor(T a, T b) {
    if (b < 0) a = -a, b = -b;
    return a >= 0 ? a / b : (a + 1) / b - 1;
}

// 切り上げ(A/B以上の最小の整数)
template <class T>
T div_ceil(T a, T b) {
    if (b < 0) a = -a, b = -b;
    return a > 0 ? (a - 1) / b + 1 : a / b;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin>>N;
    cout<<div_ceil(N,2)<<" "<<div_floor(N,2)<<endl;
}
0